# playbook.yml: --- - name: "common config" hosts: localhost connection: local vars_files: - variables.yml tasks: - name: "check the variable: hostname" fail: msg="The variable 'hostname' in variables.yml, has to be set to somethings else than CHANGEME" when: '"CHANGEME" in hostname' - name: change hostname on myserver to {{ hostname }} hostname: name: "{{ hostname }}" - name: add myself to /etc/hosts lineinfile: dest: /etc/hosts regexp: '^127\.0\.0\.1[ \t]+localhost' line: '127.0.0.1 localhost {{ hostname }}' state: present - name: Set timezone to {{ timezone }} timezone: name: "{{ timezone }}" # - name: "copy influxdb.repo" # copy: # backup: yes # src: "{{ playbook_dir }}/repo/influxdb.repo" # dest: /etc/yum.repos.d/influxdb.repo # owner: root # group: root # mode: '0644' # when: ansible_distribution == 'Amazon' # # - name: download repo # shell: sed -i "s/\$releasever/$(rpm -E %{rhel})/g" /etc/yum.repos.d/influxdb.repo # when: ansible_distribution == 'Amazon' # # # - name: Update cache and install a list of COMMON packages with a list variable # ansible.builtin.yum: # name: "{{ packages }}" # update_cache: true # vars: # packages: # - telegraf # - wget # when: ansible_distribution == 'CentOS' # # - name: Install docker on CentOS (tested on 7) # ansible.builtin.yum: # name: "{{ packages }}" # vars: # packages: # - containerd.io # - docker-ce # - docker-ce-cli # when: ansible_distribution == 'CentOS' # # - name: Install docker on AmazonLinux (tested on v2) # ansible.builtin.yum: # name: "{{ packages }}" # vars: # packages: # - docker # when: ansible_distribution == 'Amazon' - name: "telegraf" include_role: name: telegraf # when: (ansible_distribution == 'Debian') or (ansible_distribution == 'Ubuntu') - name: "docker" include_role: name: docker # when: (ansible_distribution == 'Debian') or (ansible_distribution == 'Ubuntu') - name: "copy telegraf.conf" copy: backup: yes src: "{{ playbook_dir }}/repo/telegraf.conf" dest: /etc/telegraf/telegraf.conf owner: root group: root mode: '0644' - name: "copy telegraf.d/jitsi.conf" copy: backup: yes src: "{{ playbook_dir }}/repo/telegraf_jitsi.conf" dest: /etc/telegraf/telegraf.d/jitsi.conf owner: root group: root mode: '0644' - name: Reload telegraf and enable it onboot ansible.builtin.service: name: telegraf state: reloaded enabled: yes ### Blocco usato per recuperare automaticamente l'ultima versione stabile di docker-jitsi-meet in quanto un clone del repo senza tag fa usare versioni unstable ### e' stato commentato in quanto la versione viene definita nelle variabili in modo da poterla tracciare e validare il playbook # # - name: retrieve docker-jitsi-meet latest stable tag # shell: curl -s https://api.github.com/repos/jitsi/docker-jitsi-meet/releases/latest | grep tag_name | cut -d '"' -f 4 # register: jitsi_latest_stable # delegate_to: 127.0.0.1 # run_once: true # # - set_fact: # jitsi_latest_stable={{ jitsi_latest_stable.stdout }} - name: checkout docker-jitsi-meet git repo latest stable tag {{ jitsi_latest_stable }} ansible.builtin.git: repo: 'https://github.com/jitsi/docker-jitsi-meet' dest: /root/docker-jitsi-meet version: "{{ jitsi_latest_stable }}" ## Per aggiunta plugin moderazione # # - name: checkout moderation plugin git repo # ansible.builtin.git: # repo: 'https://github.com/nvonahsen/jitsi-token-moderation-plugin' # dest: /root/jitsi-token-moderation-plugin - name: copy configfile template: src: repo/env.j2 dest: /root/docker-jitsi-meet/.env - name: generate new passwords for internal jitsi components ansible.builtin.shell: /root/docker-jitsi-meet/gen-passwords.sh args: chdir: /root/docker-jitsi-meet/ - name: pull, build and start jitsi ansible.builtin.shell: docker-compose up -d args: chdir: /root/docker-jitsi-meet/ - name: pausa di 45 secondi per la fine del deploy di jitsi ansible.builtin.pause: seconds: 45 ## Per aggiunta plugin moderazione # # - name: stop jitsi # ansible.builtin.shell: docker-compose stop # args: # chdir: /root/docker-jitsi-meet/ # # - name: copy moderation plugin to it's correct folder # ansible.builtin.shell: cp jitsi-token-moderation-plugin/mod_token_moderation.lua .jitsi-meet-cfg/prosody/prosody-plugins-custom/ && chown 101 .jitsi-meet-cfg/prosody/prosody-plugins-custom/mod_token_moderation.lua # args: # chdir: /root/ # # - name: start jitsi # ansible.builtin.shell: docker-compose start # args: # chdir: /root/docker-jitsi-meet/