ansible-jitsi.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. hosts: localhost
  68. connection: local
  69. roles:
  70. - telegraf
  71. # when: (ansible_distribution == 'Debian') or (ansible_distribution == 'Ubuntu')
  72. - name: "docker"
  73. hosts: localhost
  74. connection: local
  75. roles:
  76. - docker
  77. # when: (ansible_distribution == 'Debian') or (ansible_distribution == 'Ubuntu')
  78. - name: "copy telegraf.conf"
  79. copy:
  80. backup: yes
  81. src: "{{ playbook_dir }}/repo/telegraf.conf"
  82. dest: /etc/telegraf/telegraf.conf
  83. owner: root
  84. group: root
  85. mode: '0644'
  86. - name: "copy telegraf.d/jitsi.conf"
  87. copy:
  88. backup: yes
  89. src: "{{ playbook_dir }}/repo/telegraf_jitsi.conf"
  90. dest: /etc/telegraf/telegraf.d/jitsi.conf
  91. owner: root
  92. group: root
  93. mode: '0644'
  94. - name: Reload telegraf and enable it onboot
  95. ansible.builtin.service:
  96. name: telegraf
  97. state: reloaded
  98. enabled: yes
  99. ### 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
  100. ### e' stato commentato in quanto la versione viene definita nelle variabili in modo da poterla tracciare e validare il playbook
  101. #
  102. # - name: retrieve docker-jitsi-meet latest stable tag
  103. # shell: curl -s https://api.github.com/repos/jitsi/docker-jitsi-meet/releases/latest | grep tag_name | cut -d '"' -f 4
  104. # register: jitsi_latest_stable
  105. # delegate_to: 127.0.0.1
  106. # run_once: true
  107. #
  108. # - set_fact:
  109. # jitsi_latest_stable={{ jitsi_latest_stable.stdout }}
  110. - name: checkout docker-jitsi-meet git repo latest stable tag {{ jitsi_latest_stable }}
  111. ansible.builtin.git:
  112. repo: 'https://github.com/jitsi/docker-jitsi-meet'
  113. dest: /root/docker-jitsi-meet
  114. version: "{{ jitsi_latest_stable }}"
  115. ## Per aggiunta plugin moderazione
  116. #
  117. # - name: checkout moderation plugin git repo
  118. # ansible.builtin.git:
  119. # repo: 'https://github.com/nvonahsen/jitsi-token-moderation-plugin'
  120. # dest: /root/jitsi-token-moderation-plugin
  121. - name: copy configfile
  122. template:
  123. src: repo/env.j2
  124. dest: /root/docker-jitsi-meet/.env
  125. - name: generate new passwords for internal jitsi components
  126. ansible.builtin.shell: /root/docker-jitsi-meet/gen-passwords.sh
  127. args:
  128. chdir: /root/docker-jitsi-meet/
  129. - name: pull, build and start jitsi
  130. ansible.builtin.shell: docker-compose up -d
  131. args:
  132. chdir: /root/docker-jitsi-meet/
  133. - name: pausa di 45 secondi per la fine del deploy di jitsi
  134. ansible.builtin.pause:
  135. seconds: 45
  136. ## Per aggiunta plugin moderazione
  137. #
  138. # - name: stop jitsi
  139. # ansible.builtin.shell: docker-compose stop
  140. # args:
  141. # chdir: /root/docker-jitsi-meet/
  142. #
  143. # - name: copy moderation plugin to it's correct folder
  144. # 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
  145. # args:
  146. # chdir: /root/
  147. #
  148. # - name: start jitsi
  149. # ansible.builtin.shell: docker-compose start
  150. # args:
  151. # chdir: /root/docker-jitsi-meet/