Skip to content

Commit

Permalink
Cleanup unnecessary block
Browse files Browse the repository at this point in the history
Signed-off-by: marioqxx <82337956-marioqxx@users.noreply.github.com>
  • Loading branch information
marioqxx committed Mar 12, 2023
1 parent 4d2d626 commit deece98
Showing 1 changed file with 48 additions and 50 deletions.
98 changes: 48 additions & 50 deletions roles/install_nextcloud/tasks/nc_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,55 @@
nc_app_source: "{{ item.value.source if item.value.source is defined else item.value }}"
nc_app_cfg: "{{ item.value }}"

- name: "[App] - Download, install, enable and if provided configure Nextcloud Apps"
block:
- name: "[App] - Verify the yaml declaration for the app \"{{ nc_app_name }}\""
ansible.builtin.assert:
that:
- (nc_app_cfg.source is defined) and (nc_app_cfg.source is string)
msg: "{{ nc_app_name }} is not well declared."
when: nc_app_cfg is not string
- name: "[App] - Verify the yaml declaration for the app \"{{ nc_app_name }}\""
ansible.builtin.assert:
that:
- (nc_app_cfg.source is defined) and (nc_app_cfg.source is string)
msg: "{{ nc_app_name }} is not well declared."
when: nc_app_cfg is not string

- name: "[App] - Install from the official app-store app: \"{{ nc_app_name }}\""
become_user: "{{ nextcloud_websrv_user }}"
become_flags: "{{ ansible_become_flags | default(omit) }}"
become: true
ansible.builtin.command: php occ app:install "{{ nc_app_name }}"
args:
chdir: "{{ nextcloud_webroot }}"
when: (nc_app_source is string) and (nc_app_source | length == 0)
register: output
changed_when: "output.rc == 0"
- name: "[App] - Install from the official app-store app: \"{{ nc_app_name }}\""
become_user: "{{ nextcloud_websrv_user }}"
become_flags: "{{ ansible_become_flags | default(omit) }}"
become: true
ansible.builtin.command: php occ app:install "{{ nc_app_name }}"
args:
chdir: "{{ nextcloud_webroot }}"
when: (nc_app_source is string) and (nc_app_source | length == 0)
register: output
changed_when: "output.rc == 0"

- name: "[App] - Download Archive in apps folder from \"{{ nc_app_source }}\""
become_user: "{{ nextcloud_websrv_user }}"
become_flags: "{{ ansible_become_flags | default(omit) }}"
ansible.builtin.unarchive:
copy: false
src: "{{ nc_app_source }}"
dest: "{{ nextcloud_webroot }}/apps/"
owner: "{{ nextcloud_websrv_user }}"
group: "{{ nextcloud_websrv_group }}"
creates: "{{ nextcloud_webroot }}/apps/{{ nc_app_name }}"
when: (nc_app_source is string) and (nc_app_source | length > 0)
- name: "[App] - Download Archive in apps folder from \"{{ nc_app_source }}\""
become_user: "{{ nextcloud_websrv_user }}"
become_flags: "{{ ansible_become_flags | default(omit) }}"
ansible.builtin.unarchive:
copy: false
src: "{{ nc_app_source }}"
dest: "{{ nextcloud_webroot }}/apps/"
owner: "{{ nextcloud_websrv_user }}"
group: "{{ nextcloud_websrv_group }}"
creates: "{{ nextcloud_webroot }}/apps/{{ nc_app_name }}"
when: (nc_app_source is string) and (nc_app_source | length > 0)

- name: "[App] - Enable the application \"{{ nc_app_name }}\""
become_user: "{{ nextcloud_websrv_user }}"
become_flags: "{{ ansible_become_flags | default(omit) }}"
become: true
ansible.builtin.command: php occ app:enable "{{ nc_app_name }}"
args:
chdir: "{{ nextcloud_webroot }}"
changed_when: true
- name: "[App] - Enable the application \"{{ nc_app_name }}\""
become_user: "{{ nextcloud_websrv_user }}"
become_flags: "{{ ansible_become_flags | default(omit) }}"
become: true
ansible.builtin.command: php occ app:enable "{{ nc_app_name }}"
args:
chdir: "{{ nextcloud_webroot }}"
changed_when: true

- name: "[App] - Configure the application \"{{ nc_app_name }}\""
become_user: "{{ nextcloud_websrv_user }}"
become_flags: "{{ ansible_become_flags | default(omit) }}"
become: true
ansible.builtin.command: php occ config:app:set {{ nc_app_name }} {{ item_cfg.key }} --value="{{ item_cfg.value }}"
args:
chdir: "{{ nextcloud_webroot }}"
with_dict: "{{ nc_app_cfg.conf | default({}) }}"
loop_control:
loop_var: item_cfg
when: nc_app_cfg.conf is defined
register: output
changed_when: "output.rc == 0"
- name: "[App] - Configure the application \"{{ nc_app_name }}\""
become_user: "{{ nextcloud_websrv_user }}"
become_flags: "{{ ansible_become_flags | default(omit) }}"
become: true
ansible.builtin.command: php occ config:app:set {{ nc_app_name }} {{ item_cfg.key }} --value="{{ item_cfg.value }}"
args:
chdir: "{{ nextcloud_webroot }}"
with_dict: "{{ nc_app_cfg.conf | default({}) }}"
loop_control:
loop_var: item_cfg
when: nc_app_cfg.conf is defined
register: output
changed_when: "output.rc == 0"

0 comments on commit deece98

Please sign in to comment.