123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- ---
- # tasks file for nextcloud
- - include_tasks: "prep_os/{{ ansible_os_family }}.yml"
- - include_tasks: "prep_php/{{ ansible_os_family }}.yml"
- - name: Main... Create shared directories
- file:
- path: "{{ item }}"
- state: directory
- owner: "{{ nextcloud_websrv_user }}"
- group: "{{ nextcloud_websrv_group }}"
- mode: 0770
- with_items:
- - "{{ nc_data_dir }}"
- - "{{ http_webroot }}/nextcloud"
- when: nc_multiple != ""
- - name: Main... Mount shared directories
- mount:
- src: "{{ nfs_server }}:{{ item.src }}"
- path: "{{ item.path }}"
- state: mounted
- fstype: nfs
- opts: nosharecache,context="system_u:object_r:httpd_sys_rw_content_t:s0"
- with_items:
- - { src: "{{ nfs_data_path }}", path: "{{ nc_data_dir }}" }
- - { src: "{{ nfs_web_path }}", path: "{{ http_webroot }}/nextcloud" }
- when: nc_multiple != ""
- - name: Main... Check if Nextcloud is downloaded
- stat:
- path: "{{ http_webroot }}/nextcloud/index.php"
- register: nc_nextcloud_downloaded
- - name: Main... Download and Install Nextcloud
- include_tasks: "nc_download.yml"
- when: (nc_nextcloud_downloaded.stat.isreg is undefined) or (not nc_nextcloud_downloaded.stat.isreg)
- - name: Main... Check Nextcloud status
- become_user: "{{ nextcloud_websrv_user }}"
- become: true
- shell: "{{ php_bin }} occ status --output=json"
- args:
- chdir: "{{ http_webroot }}/nextcloud"
- register: jsoncontent
- - name: Main... Set Nextcloud variables status
- set_fact:
- nc_status: "{{ jsoncontent.stdout | from_json }}"
- - name: Main... The nc_status content
- debug: var=nc_status
- - name: Main... Install nextcloud
- include_tasks: nc_install.yml
- when: nc_status.installed|bool == false
- - name: Main... Check Selinux
- include_tasks: "selinux.yml"
- when:
- - (ansible_os_family == "RedHat")
- - (ansible_selinux.status == "enabled")
- - name: Main... Setup nextcloud
- include_tasks: nc_setup.yml
- when: nc_status.installed|bool == false
- #- name: Setup... Set Trusted Local Domain
- # become_user: "{{ nextcloud_websrv_user }}"
- # become: true
- # shell: "{{ php_bin }} occ config:system:set trusted_domains 0 --value={{ nc_trusted_domain }}"
- # args:
- # chdir: "{{ http_webroot }}/nextcloud"
- - name: Setup... Configure Cron
- cron:
- name: "Nextcloud Cronjob"
- minute: "*/{{ nc_cron_period }}"
- user: "{{ nextcloud_websrv_user }}"
- job: "{{ php_bin }} -f {{ http_webroot }}/nextcloud/cron.php"
- cron_file: "nextcloud"
- when: (nc_background_cron | bool)
- #- name: Main... Setting stronger directories ownership
- # file:
- # path: "{{ item }}"
- # state: directory
- # owner: "{{ nextcloud_websrv_user }}"
- # group: "{{ nextcloud_websrv_group }}"
- # mode: 0770
- # with_items:
- # - "{{ nc_data_dir }}"
- # - "{{ http_webroot }}/nextcloud"
- - name: Main... Restart {{ http_service_name }} service
- service:
- name: "{{ http_service_name }}"
- state: restarted
- - name: Main... First run Cron
- become_user: "{{ nextcloud_websrv_user }}"
- become: true
- shell: "{{ php_bin }} -f cron.php"
- args:
- chdir: "{{ http_webroot }}/nextcloud"
|