main.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ---
  2. # tasks file for nextcloud
  3. - name: Main... Check Nextcloud debug speed
  4. set_fact:
  5. debug_speed_check: "{{ debug_speed }}"
  6. # include os specific tasks
  7. - include_tasks: "prep_os/{{ ansible_os_family }}.yml"
  8. # install required packages
  9. - include_tasks: "prep_php/{{ ansible_os_family }}.yml"
  10. - name: Main... Check if a mysql/mariadb database is available
  11. shell: mysql --host={{ db_host }} --user={{ nc_db_user }} --password={{ nc_db_password }} -e 'SHOW DATABASES;' | grep -cx {{ nc_db_name }}
  12. register: dbstatus
  13. failed_when: "dbstatus.stdout|int != 1"
  14. no_log: true
  15. - name: Main... Check Nextcloud installed
  16. stat:
  17. path: "{{ http_webroot }}/nextcloud/index.php"
  18. register: nc_nextcloud_installed
  19. - name: Main... Download and Install Nextcloud
  20. include_tasks: "nc_download.yml"
  21. when: (nc_nextcloud_installed.stat.isreg is undefined) or (not nc_nextcloud_installed.stat.isreg)
  22. - name: Main... Check Nextcloud is installed
  23. shell: grep installed {{ http_webroot }}/nextcloud/config/config.php | grep true | wc -l
  24. register: nc_installation_configured
  25. - name: Main... Install nextcloud
  26. include_tasks: nc_install.yml
  27. when: nc_installation_configured.stdout|int == 0
  28. - name: Main... Check Selinux
  29. include_tasks: "selinux.yml"
  30. when:
  31. - (ansible_os_family == "RedHat")
  32. - (ansible_selinux.status == "enabled")
  33. - name: Main... Setup nextcloud
  34. include_tasks: nc_setup.yml
  35. - name: Main... Restart {{ http_service_name }} service
  36. service:
  37. name: "{{ http_service_name }}"
  38. state: restarted
  39. - name: Main... First run Cron
  40. become_user: "{{ nextcloud_websrv_user }}"
  41. become: true
  42. shell: "{{ php_bin }} -f cron.php"
  43. args:
  44. chdir: "{{ http_webroot }}/nextcloud"