48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
---
|
|
- name: List mailcow installations with Roundcube
|
|
hosts: all
|
|
user: tincadmin
|
|
become: true
|
|
gather_facts: false
|
|
|
|
vars:
|
|
mailcow_search_paths:
|
|
- /opt
|
|
- /data
|
|
- /root
|
|
- /storage
|
|
rc_dirs:
|
|
- rc
|
|
- roundcube
|
|
- roundcubemail
|
|
|
|
tasks:
|
|
- name: Find mailcow-dockerized directory
|
|
ansible.builtin.find:
|
|
file_type: directory
|
|
paths: "{{ mailcow_search_paths }}"
|
|
patterns: mailcow-dockerized
|
|
recurse: true
|
|
register: mailcow_dir_result
|
|
ignore_errors: true
|
|
|
|
- name: Set mailcow_root if found
|
|
ansible.builtin.set_fact:
|
|
mailcow_root: "{{ mailcow_dir_result.files[0].path }}"
|
|
when: mailcow_dir_result.matched | default(0) > 0
|
|
|
|
- name: Find Roundcube directories under data/web
|
|
ansible.builtin.find:
|
|
paths: "{{ mailcow_root }}/data/web"
|
|
file_type: directory
|
|
patterns: "{{ rc_dirs }}"
|
|
recurse: false
|
|
register: roundcube_result
|
|
when: mailcow_root is defined
|
|
|
|
- name: Output only affected installations
|
|
ansible.builtin.debug:
|
|
msg: "{{ inventory_hostname }}: {{ roundcube_result.files | map(attribute='path') | join(', ') }}"
|
|
when:
|
|
- roundcube_result is defined
|
|
- roundcube_result.matched | default(0) > 0 |