From 0a1b675310f2f5136d3c7c9b9df4d34575c2bf5d Mon Sep 17 00:00:00 2001 From: vincent Date: Mon, 21 Sep 2020 20:30:41 +0200 Subject: [PATCH] fix nextcloud issue --- tasks/main.yml | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 1d9e62f..0b6002b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -40,6 +40,16 @@ state: directory # not required. choices: absent;directory;file;hard;link;touch. If C(directory), all intermediate subdirectories will be created if they do not exist. Since Ansible 1.7 they will be created with the supplied permissions. If C(file), the file will NOT be created if it does not exist; see the C(touch) value or the M(copy) or M(template) module if you want that behavior. If C(link), the symbolic link will be created or changed. Use C(hard) for hardlinks. If C(absent), directories will be recursively deleted, and files or symlinks will be unlinked. Note that C(absent) will not cause C(file) to fail if the C(path) does not exist as the state did not change. If C(touch) (new in 1.4), an empty file will be created if the C(path) does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way `touch` works from the command line). owner: http # not required. Name of the user that should own the file/directory, as would be fed to I(chown). +- name: création du fichier .ocdata in data + become: true + file: + path: "{{ nextcloud_datadirectory }}/.ocdata" + group: http # not required. Name of the group that should own the file/directory, as would be fed to I(chown). + state: touch # not required. choices: absent;directory;file;hard;link;touch. If C(directory), all intermediate subdirectories will be created if they do not exist. Since Ansible 1.7 they will be created with the supplied permissions. If C(file), the file will NOT be created if it does not exist; see the C(touch) value or the M(copy) or M(template) module if you want that behavior. If C(link), the symbolic link will be created or changed. Use C(hard) for hardlinks. If C(absent), directories will be recursively deleted, and files or symlinks will be unlinked. Note that C(absent) will not cause C(file) to fail if the C(path) does not exist as the state did not change. If C(touch) (new in 1.4), an empty file will be created if the C(path) does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way `touch` works from the command line). + owner: http # not required. Name of the user that should own the file/directory, as would be fed to I(chown). + + + - name: check if config exist stat: path: /etc/webapps/nextcloud/config/config.php # required. The full path of the file/object to get the facts of. @@ -62,8 +72,18 @@ become: true become_user: http changed_when: true + ignore_errors: yes when: installed_mode is changed or nextcloud_config_exist.stat.exists == false - + +- name: ensure additional options are set in config.php if defined + become: true + lineinfile: + path: '{{ nextcloud_web_root }}/config/config.php' + regexp: '^\s*''{{ item.option }}''' + line: ' ''{{ item.option }}'' => {{ item.value }},' + insertafter: '\$CONFIG' + with_items: '{{ nextcloud_config_options }}' + when: nextcloud_config_options is defined - name: installation - ensure trusted domains are set command: 'php {{ nextcloud_web_root }}/occ config:system:set trusted_domains {{ item.0 }} --value "{{ item.1 }}"' @@ -83,15 +103,8 @@ with_items: '{{ nextcloud_db_options }}' when: nextcloud_config_options is defined -- name: ensure additional options are set in config.php if defined - become: true - lineinfile: - path: '{{ nextcloud_web_root }}/config/config.php' - regexp: '^\s*''{{ item.option }}''' - line: ' ''{{ item.option }}'' => {{ item.value }},' - insertafter: '\$CONFIG' - with_items: '{{ nextcloud_config_options }}' - when: nextcloud_config_options is defined + + - name: create cron for nextcloud cron: