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.

169 lines
4.0 KiB

  1. ---
  2. - name: 'install requirements'
  3. apt:
  4. pkg:
  5. - 'postgresql'
  6. - 'postgresql-contrib'
  7. - 'python3-psycopg2'
  8. - 'ca-certificates'
  9. - 'gnupg'
  10. state: 'present'
  11. update_cache: true
  12. cache_valid_time: 3600
  13. tags:
  14. - 'packages'
  15. - name: 'nodejs | trust apt repo'
  16. apt_key:
  17. id: '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280'
  18. url: 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key'
  19. state: 'present'
  20. tags:
  21. - 'packages'
  22. - name: 'nodejs | add apt repo'
  23. apt_repository:
  24. repo: '{{ item }}'
  25. state: 'present'
  26. update_cache: true
  27. loop:
  28. - 'deb https://deb.nodesource.com/node_12.x {{ ansible_distribution_release }} main'
  29. - 'deb-src https://deb.nodesource.com/node_12.x {{ ansible_distribution_release }} main'
  30. tags:
  31. - 'packages'
  32. - name: 'nodejs | install'
  33. apt:
  34. pkg: 'nodejs'
  35. state: 'present'
  36. update_cache: true
  37. cache_valid_time: 3600
  38. tags:
  39. - 'packages'
  40. - name: 'create etherpad system user'
  41. user:
  42. name: 'etherpad'
  43. state: 'present'
  44. - block:
  45. - name: 'create etherpad DB'
  46. postgresql_db:
  47. name: 'etherpad'
  48. - name: 'create etherpad DB user'
  49. postgresql_user:
  50. name: 'etherpad'
  51. db: 'etherpad'
  52. priv: 'ALL'
  53. become: true
  54. become_method: 'su'
  55. become_user: 'postgres'
  56. - name: 'create etherpad directory'
  57. file:
  58. path: '/home/etherpad/etherpad'
  59. state: 'directory'
  60. owner: 'etherpad'
  61. group: 'etherpad'
  62. - name: 'update tls ldap server ca'
  63. copy:
  64. content: '{{ ldap_tls_server_ca }}'
  65. dest: '/etc/ldap/server_ca.crt'
  66. tags:
  67. - 'tls_int'
  68. - name: 'configure ldap client'
  69. copy:
  70. src: 'ldap.conf'
  71. dest: '/etc/ldap/ldap.conf'
  72. - name: 'generate etherpad ldap password'
  73. gen_passwd: length=32
  74. register: etherpad_ldap_passwd
  75. no_log: true
  76. - name: 'set etherpad ldap password in ldap'
  77. delegate_to: 'localhost'
  78. ldap_passwd:
  79. dn: 'cn={{ host_fqdn }},ou=Server,{{ ldap_basedn }}'
  80. passwd: '{{ etherpad_ldap_passwd.passwd }}'
  81. server_uri: 'ldap://{{ ldap_server }}'
  82. start_tls: '{{ ldap_tls_enabled }}'
  83. bind_dn: '{{ ldap_admin_dn }}'
  84. bind_pw: '{{ ldap_admin_pw }}'
  85. - block:
  86. - name: 'download and unpack etherpad'
  87. unarchive:
  88. remote_src: true
  89. src: 'https://github.com/ether/etherpad-lite/archive/{{ etherpad_version }}.tar.gz'
  90. dest: '/home/etherpad/etherpad'
  91. extra_opts:
  92. - '--strip-components=1'
  93. tags:
  94. - 'packages'
  95. - name: 'create node_modules dir'
  96. file:
  97. path: '/home/etherpad/etherpad/node_modules'
  98. state: 'directory'
  99. - name: 'create ep_etherpad-lite symlink'
  100. file:
  101. src: '../src'
  102. path: '/home/etherpad/etherpad/node_modules/ep_etherpad-lite'
  103. state: 'link'
  104. - name: 'install npm dependencies'
  105. npm:
  106. path: '/home/etherpad/etherpad/node_modules/ep_etherpad-lite'
  107. state: 'latest'
  108. production: true
  109. tags:
  110. - 'packages'
  111. - name: 'install ldap driver'
  112. npm:
  113. path: '/home/etherpad/etherpad'
  114. name: 'ep_ldapauth'
  115. state: 'latest'
  116. production: true
  117. tags:
  118. - 'packages'
  119. - name: 'install plugins'
  120. npm:
  121. path: '/home/etherpad/etherpad'
  122. name: '{{ item }}'
  123. state: 'latest'
  124. production: true
  125. loop:
  126. - 'ep_markdown'
  127. - name: 'configure etherpad'
  128. template:
  129. src: 'settings.json.j2'
  130. dest: '/home/etherpad/etherpad/settings.json'
  131. notify: 'restart etherpad-lite'
  132. become: true
  133. become_user: 'etherpad'
  134. become_method: 'su'
  135. - name: 'create etherpad service'
  136. copy:
  137. src: 'etherpad.service'
  138. dest: '/etc/systemd/system/etherpad-lite.service'
  139. - import_role: name='service'
  140. vars:
  141. service_name: 'etherpad-lite'
  142. - name: 'create nginx configuration'
  143. template:
  144. src: 'etherpad.conf.j2'
  145. dest: '/etc/nginx/locations/{{ etherpad_nginx_fqdn }}/etherpad.conf'
  146. vars:
  147. nginx_proxy_remote_host: 'http://127.0.0.1:9001'
  148. notify: 'reload nginx'
  149. ...