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.

60 lines
1.5 KiB

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