nc_install.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. #########
  3. # Run command line installation.
  4. # the web server must be running by now in order to launch the installation
  5. - name: Install... Removing possibly old or incomplete config.php
  6. file:
  7. path: "{{ http_webroot }}/nextcloud/config/config.php"
  8. state: absent
  9. - name: Install... Create custom_apps directory
  10. file:
  11. path: "{{ http_webroot }}/nextcloud/custom_apps"
  12. state: directory
  13. owner: "{{ nextcloud_websrv_user }}"
  14. group: "{{ nextcloud_websrv_group }}"
  15. mode: 0770
  16. #- name: Install... Create data directory
  17. # file:
  18. # path: "{{ nc_data_dir }}"
  19. # state: directory
  20. # owner: "{{ nextcloud_websrv_user }}"
  21. # group: "{{ nextcloud_websrv_group }}"
  22. # mode: 0770
  23. # when: nc_multiple == ""
  24. - name: Install... Check if a mysql/mariadb database is available
  25. shell: mysql --host={{ db_host }} --user={{ nc_db_user }} --password={{ nc_db_password }} --port={{ db_port }} -e "show status like 'Connections%';"
  26. no_log: true
  27. - name: Install... First setup Nextcloud
  28. become_user: "{{ nextcloud_websrv_user }}"
  29. become: true
  30. shell: "{{ php_bin }} occ maintenance:install --database=mysql --database-host={{ db_host }} --database-port={{ db_port }} --database-name={{ nc_db_name }} --database-user={{ nc_db_user }} --database-pass={{ nc_db_password }} --admin-user={{ nc_admin_name }} --admin-pass={{ nc_admin_pwd }} --data-dir={{ nc_data_dir }}"
  31. args:
  32. chdir: "{{ http_webroot }}/nextcloud"
  33. creates: "{{ http_webroot }}/nextcloud/config/config.php"
  34. register: setup_nc
  35. #no_log: true
  36. - name: Install... Removing possibly sample config
  37. file:
  38. path: "{{ item }}"
  39. state: absent
  40. with_items:
  41. - "{{ http_webroot }}/nextcloud/config/config.sample.php"
  42. - "{{ http_webroot }}/nextcloud/config/CAN_INSTALL"