ansible-infra/roles/nextcloud/tasks/main.yaml
June abc738c9c2
All checks were successful
/ Ansible Lint (push) Successful in 1m33s
flatten the "playbooks" directory for better structure
Because of how Ansible local relative search paths work, the global
"files" and "templates" directories need to be next to the playbooks.
However its not intuitive to look into the playbooks directory to find
the files and templates for a host.
Therefore flatten the playbooks directory to get rid of this confusing
structure.

Also see:
https://docs.ansible.com/ansible/latest/playbook_guide/playbook_pathing.html#resolving-local-relative-paths
2024-12-02 00:48:19 +01:00

58 lines
2.1 KiB
YAML

---
- name: wait for existence of config directory
ansible.builtin.wait_for:
path: /ansible_docker_compose/nextcloud_var_www_html/config
state: present
become: true
- name: extra Nextcloud configuration
ansible.builtin.copy:
content: "{{ nextcloud__extra_configuration }}"
dest: /ansible_docker_compose/nextcloud_var_www_html/config/ansible_nextcloud_extra_config.config.php
mode: "0644"
owner: www-data
group: www-data
become: true
- name: fail, if nextcloud__use_custom_new_user_skeleton is set, but nextcloud__custom_new_user_skeleton_directory isn't
ansible.builtin.fail:
msg: If you set nextcloud__use_custom_new_user_skeleton, you also need to set nextcloud__custom_new_user_skeleton_directory.
when: nextcloud__use_custom_new_user_skeleton and nextcloud__custom_new_user_skeleton_directory == ""
- name: ensure custom new user skeleton
when: nextcloud__use_custom_new_user_skeleton
block:
- name: ensure `rsync` package is installed
ansible.builtin.apt:
name: rsync
state: present
become: true
- name: ensure custom new user skeleton directory
ansible.posix.synchronize:
src: "{{ nextcloud__custom_new_user_skeleton_directory }}"
dest: /ansible_docker_compose/custom_new_user_skeleton
delete: true
recursive: true
use_ssh_args: true
become: true
- name: ensure custom new user skeleton config
ansible.builtin.copy:
content: |
<?php
$CONFIG = array (
'skeletondirectory' => '/custom_new_user_skeleton'
);
dest: /ansible_docker_compose/nextcloud_var_www_html/config/ansible_nextcloud_custom_new_user_skeleton.config.php
mode: "0644"
owner: www-data
group: www-data
become: true
- name: ensure absence of custom new user skeleton config
ansible.builtin.file:
path: /ansible_docker_compose/nextcloud_var_www_html/config/ansible_nextcloud_custom_new_user_skeleton.config.php
state: absent
become: true
when: not nextcloud__use_custom_new_user_skeleton