Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.0 KiB

  1. ---
  2. - name: 'alpine links'
  3. file: path='/etc/init.d/coturn' src='turnserver' state='link' force=true
  4. when: ansible_distribution == 'Alpine'
  5. - name: 'install coturn'
  6. import_role: name='service'
  7. vars:
  8. service_name: 'coturn'
  9. service_packages:
  10. - 'coturn'
  11. - name: 'check if rest-api shared secret exists'
  12. stat:
  13. path: '/etc/coturn_rest.secret'
  14. register: coturn_secret_stat
  15. - block:
  16. - name: 'slurp shared secret'
  17. slurp:
  18. path: '/etc/coturn_rest.secret'
  19. register: coturn_secret_slurp
  20. - name: 'set shared secret'
  21. set_fact:
  22. shared_secret: '{{ coturn_secret_slurp.content | b64decode }}'
  23. when: (not renew_shared_secret) and (coturn_secret_stat.stat.exists)
  24. - block:
  25. - name: 'generate new shared secret'
  26. gen_passwd: 'length=32'
  27. register: new_passwd
  28. - name: 'store new shared secret'
  29. copy:
  30. content: '{{ new_passwd.passwd }}'
  31. dest: '/etc/coturn_rest.secret'
  32. - name: 'set shared secret'
  33. set_fact:
  34. shared_secret: '{{ new_passwd.passwd }}'
  35. when: (renew_shared_secret) or (not coturn_secret_stat.stat.exists)
  36. tags:
  37. - 'service_password'
  38. - name: 'set-up port forwarding for listener'
  39. import_role: name='port_forwarding'
  40. vars:
  41. rule_name: 'turn'
  42. proto: 'tcp udp'
  43. port: '{{ turn_port }}'
  44. - name: 'set-up port forwarding for relay'
  45. import_role: name='port_forwarding'
  46. vars:
  47. rule_name: 'turn_relay'
  48. proto: 'udp'
  49. port: '{{ min_relay_port }}-{{ max_relay_port }}'
  50. - name: 'update coturn config'
  51. template:
  52. src: 'turnserver.conf.j2'
  53. dest: '/etc/turnserver.conf'
  54. notify: 'restart coturn'
  55. tags:
  56. - 'service_password'
  57. - name: 'alpine links'
  58. file: path='/etc/coturn/turnserver.conf' src='../turnserver.conf' state='link'
  59. when: ansible_distribution == 'Alpine'
  60. notify: 'restart coturn'
  61. - name: 'alpine init fix 1'
  62. lineinfile: path='/etc/init.d/turnserver' line='command_user=root' regexp='^command_user='
  63. notify: 'restart coturn'