Something went wrong on our end
-
Baptiste DE RENZO authoredBaptiste DE RENZO authored
main.yml 6.54 KiB
---
- name: mediaserver install
ansible.builtin.apt:
force_apt_get: true
install_recommends: false
name: "{{ server_packages }}"
register: apt_status
retries: 60
until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)
- name: fetch ssh public key
register: root_ssh_pubkey
ansible.builtin.slurp:
path: /root/.ssh/id_ed25519.pub
tags: always
- name: register ssh public key as an ansible fact
ansible.builtin.set_fact:
pubkey: "{{ root_ssh_pubkey['content'] | b64decode }}"
tags: always
- name: share ssh public key between cluster members
loop: "{{ groups['mediaserver'] }}"
ansible.posix.authorized_key:
user: root
key: "{{ hostvars[item]['pubkey'] }}"
tags: always
- name: Update the MS configuration with the celerity server IP
ansible.builtin.lineinfile:
path: /etc/mediaserver/msconf.py
regexp: "^CELERITY_SERVER_URL = "
line: CELERITY_SERVER_URL = 'https://{{ server_celerity_server_url }}:6200'
create: true
owner: root
group: root
# 644 as all the instances must reach this file
# The instances cannot be in a common group as of now => https://redmine.ubicast.net/issues/33046
mode: "0644"
- name: Update the MS configuration with the celerity server secret
ansible.builtin.lineinfile:
path: /etc/mediaserver/msconf.py
regexp: "^CELERITY_SIGNING_KEY = "
line: CELERITY_SIGNING_KEY = '{{ server_celerity_signing_key }}'
create: true
owner: root
group: root
# 644 as all the instances must reach this file
# The instances cannot be in a common group as of now => https://redmine.ubicast.net/issues/33046
mode: "0644"
- name: create instances
loop: "{{ server_instances }}"
ansible.builtin.command:
cmd: >
mscontroller.py add -u '{{ item.name }}' -t '{
"id": "{{ item.ms_id }}",
"domain": "{{ item.ms_server_name }}",
"api_key": "{{ item.ms_api_key }}",
"secret": "{{ envsetup_ms_secret | d("") }}",
"superuser_pwd": "{{ item.ms_superuser_pwd }}",
"admin_pwd": "{{ item.ms_admin_pwd }}",
"skyreach_url": "{{ item.cm_server_name }}"
}'
creates: /etc/nginx/sites-available/mediaserver-{{ item.name }}.conf
throttle: 1
- name: synchronize configuration between servers # noqa command-instead-of-module
# Cannot use the ansible synchronization module, cause there is no way to set a destination IP intead of the destination ansible hostname