nc_install.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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 data directory
  10. file:
  11. path: "{{ item }}"
  12. state: directory
  13. owner: "{{ nextcloud_websrv_user }}"
  14. group: "{{ nextcloud_websrv_group }}"
  15. mode: 0770
  16. with_items:
  17. - "{{ nc_data_dir }}"
  18. - "{{ http_webroot }}/nextcloud/custom_apps"
  19. - name: Install... First setup Nextcloud
  20. become_user: "{{ nextcloud_websrv_user }}"
  21. become: true
  22. shell: "{{ php_bin }} occ maintenance:install --database=mysql --database-host={{ db_host }} --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 }}"
  23. args:
  24. chdir: "{{ http_webroot }}/nextcloud"
  25. creates: "{{ http_webroot }}/nextcloud/config/config.php"
  26. register: setup_nc
  27. - name: Install... Removing possibly sample config
  28. file:
  29. path: "{{ http_webroot }}/nextcloud/config/config.sample.php"
  30. state: absent