ansible-jitsi.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. # playbook.yml:
  2. ---
  3. - name: "common config"
  4. hosts: localhost
  5. connection: local
  6. vars_files:
  7. - variables.yml
  8. tasks:
  9. - name: "check the variable: hostname"
  10. fail: msg="The variable 'hostname' in variables.yml, has to be set to somethings else than CHANGEME"
  11. when: '"CHANGEME" in hostname'
  12. - name: change hostname on myserver to {{ hostname }}
  13. hostname:
  14. name: "{{ hostname }}"
  15. - name: add myself to /etc/hosts
  16. lineinfile:
  17. dest: /etc/hosts
  18. regexp: '^127\.0\.0\.1[ \t]+localhost'
  19. line: '127.0.0.1 localhost {{ hostname }}'
  20. state: present
  21. - name: Set timezone to {{ timezone }}
  22. timezone:
  23. name: "{{ timezone }}"
  24. # - name: "copy influxdb.repo"
  25. # copy:
  26. # backup: yes
  27. # src: "{{ playbook_dir }}/repo/influxdb.repo"
  28. # dest: /etc/yum.repos.d/influxdb.repo
  29. # owner: root
  30. # group: root
  31. # mode: '0644'
  32. # when: ansible_distribution == 'Amazon'
  33. #
  34. # - name: download repo
  35. # shell: sed -i "s/\$releasever/$(rpm -E %{rhel})/g" /etc/yum.repos.d/influxdb.repo
  36. # when: ansible_distribution == 'Amazon'
  37. #
  38. #
  39. # - name: Update cache and install a list of COMMON packages with a list variable
  40. # ansible.builtin.yum:
  41. # name: "{{ packages }}"
  42. # update_cache: true
  43. # vars:
  44. # packages:
  45. # - telegraf
  46. # - wget
  47. # when: ansible_distribution == 'CentOS'
  48. #
  49. # - name: Install docker on CentOS (tested on 7)
  50. # ansible.builtin.yum:
  51. # name: "{{ packages }}"
  52. # vars:
  53. # packages:
  54. # - containerd.io
  55. # - docker-ce
  56. # - docker-ce-cli
  57. # when: ansible_distribution == 'CentOS'
  58. #
  59. # - name: Install docker on AmazonLinux (tested on v2)
  60. # ansible.builtin.yum:
  61. # name: "{{ packages }}"
  62. # vars:
  63. # packages:
  64. # - docker
  65. # when: ansible_distribution == 'Amazon'
  66. - name: "telegraf"
  67. include_role:
  68. name: telegraf
  69. # when: (ansible_distribution == 'Debian') or (ansible_distribution == 'Ubuntu')
  70. - name: "docker"
  71. include_role:
  72. name: docker
  73. # when: (ansible_distribution == 'Debian') or (ansible_distribution == 'Ubuntu')
  74. - name: "copy telegraf.conf"
  75. copy:
  76. backup: yes
  77. src: "{{ playbook_dir }}/repo/telegraf.conf"
  78. dest: /etc/telegraf/telegraf.conf
  79. owner: root
  80. group: root
  81. mode: '0644'
  82. - name: "copy telegraf.d/jitsi.conf"
  83. copy:
  84. backup: yes
  85. src: "{{ playbook_dir }}/repo/telegraf_jitsi.conf"
  86. dest: /etc/telegraf/telegraf.d/jitsi.conf
  87. owner: root
  88. group: root
  89. mode: '0644'
  90. - name: Reload telegraf and enable it onboot
  91. ansible.builtin.service:
  92. name: telegraf
  93. state: reloaded
  94. enabled: yes
  95. ### 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
  96. ### e' stato commentato in quanto la versione viene definita nelle variabili in modo da poterla tracciare e validare il playbook
  97. #
  98. # - name: retrieve docker-jitsi-meet latest stable tag
  99. # shell: curl -s https://api.github.com/repos/jitsi/docker-jitsi-meet/releases/latest | grep tag_name | cut -d '"' -f 4
  100. # register: jitsi_latest_stable
  101. # delegate_to: 127.0.0.1
  102. # run_once: true
  103. #
  104. # - set_fact:
  105. # jitsi_latest_stable={{ jitsi_latest_stable.stdout }}
  106. - name: checkout docker-jitsi-meet git repo latest stable tag {{ jitsi_latest_stable }}
  107. ansible.builtin.git:
  108. repo: 'https://github.com/jitsi/docker-jitsi-meet'
  109. dest: /root/docker-jitsi-meet
  110. version: "{{ jitsi_latest_stable }}"
  111. ## Per aggiunta plugin moderazione
  112. #
  113. # - name: checkout moderation plugin git repo
  114. # ansible.builtin.git:
  115. # repo: 'https://github.com/nvonahsen/jitsi-token-moderation-plugin'
  116. # dest: /root/jitsi-token-moderation-plugin
  117. - name: copy configfile
  118. template:
  119. src: repo/env.j2
  120. dest: /root/docker-jitsi-meet/.env
  121. - name: generate new passwords for internal jitsi components
  122. ansible.builtin.shell: /root/docker-jitsi-meet/gen-passwords.sh
  123. args:
  124. chdir: /root/docker-jitsi-meet/
  125. - name: pull, build and start jitsi
  126. ansible.builtin.shell: docker-compose up -d
  127. args:
  128. chdir: /root/docker-jitsi-meet/
  129. - name: pausa di 45 secondi per la fine del deploy di jitsi
  130. ansible.builtin.pause:
  131. seconds: 45
  132. ## Per aggiunta plugin moderazione
  133. #
  134. # - name: stop jitsi
  135. # ansible.builtin.shell: docker-compose stop
  136. # args:
  137. # chdir: /root/docker-jitsi-meet/
  138. #
  139. # - name: copy moderation plugin to it's correct folder
  140. # 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
  141. # args:
  142. # chdir: /root/
  143. #
  144. # - name: start jitsi
  145. # ansible.builtin.shell: docker-compose start
  146. # args:
  147. # chdir: /root/docker-jitsi-meet/