diff --git a/playbooks/cleanups/cleanup-cmk-agent-plugins.yml b/playbooks/cleanups/cleanup-cmk-agent-plugins.yml new file mode 100644 index 0000000..3d804e2 --- /dev/null +++ b/playbooks/cleanups/cleanup-cmk-agent-plugins.yml @@ -0,0 +1,9 @@ +- hosts: all + user: tincadmin + gather_facts: false + become: true + tasks: + - name: Include Checkmk Agent Plugins Cleanup task + ansible.builtin.include_role: + name: checkmk-monitoring + tasks_from: cleanup-agent-plugins \ No newline at end of file diff --git a/playbooks/managed-mailcow/find-roundcube-installations.yaml b/playbooks/managed-mailcow/find-roundcube-installations.yaml new file mode 100644 index 0000000..cb5b978 --- /dev/null +++ b/playbooks/managed-mailcow/find-roundcube-installations.yaml @@ -0,0 +1,48 @@ +--- +- 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 \ No newline at end of file diff --git a/playbooks/managed-mailcow/find-roundcube-versions.yaml b/playbooks/managed-mailcow/find-roundcube-versions.yaml deleted file mode 100644 index 07dffa5..0000000 --- a/playbooks/managed-mailcow/find-roundcube-versions.yaml +++ /dev/null @@ -1,70 +0,0 @@ ---- -- name: Check mailcow installation and extract Roundcube version from CHANGELOG.md - hosts: all - user: tincadmin - become: true - vars: - mailcow_search_paths: - - /opt - - /data - - /root - - /storage - rc_dirs: - - rc - - roundcube - - roundcubemail - - tasks: - - name: Finde mailcow-dockerized Verzeichnis - ansible.builtin.find: - file_type: directory - paths: "{{ mailcow_search_paths }}" - patterns: mailcow-dockerized - recurse: yes - register: mailcow_dir_result - ignore_errors: true - - - name: Setze mailcow_root wenn gefunden - ansible.builtin.set_fact: - mailcow_root: "{{ mailcow_dir_result.files[0].path }}" - when: mailcow_dir_result.matched > 0 - - - name: Check for Roundcube folder under data/web - ansible.builtin.stat: - path: "{{ mailcow_root }}/data/web/{{ item }}" - loop: "{{ rc_dirs }}" - register: rc_stat - when: mailcow_root is defined - - - name: Determine the actual Roundcube path - ansible.builtin.set_fact: - rc_path: "{{ mailcow_root }}/data/web/{{ item.item }}" - loop: "{{ rc_stat.results }}" - when: item.stat.exists and item.stat.isdir - - - name: Check if CHANGELOG.md exists - ansible.builtin.stat: - path: "{{ rc_path }}/CHANGELOG.md" - register: changelog_stat - when: rc_path is defined - - - name: Extrahiere Version aus CHANGELOG.md - ansible.builtin.shell: | - grep -m1 -Po '(?<=## Release )\S+' {{ rc_path }}/CHANGELOG.md - register: rc_version - changed_when: false - when: - - changelog_stat.stat.exists - - changelog_stat.stat.isfile - - - name: Gib gefundene Roundcube-Version aus - ansible.builtin.debug: - msg: "Roundcube-Version (laut CHANGELOG.md): {{ rc_version.stdout }}" - when: rc_version.stdout != "" - - - name: Warning if no CHANGELOG.md found - ansible.builtin.debug: - msg: "No CHANGELOG.md found under {{ rc_path }}." - when: - - rc_path is defined - - not changelog_stat.stat.exists \ No newline at end of file diff --git a/playbooks/managed-mailcow/update-mailcow.yaml b/playbooks/managed-mailcow/update-mailcow.yaml index 04d87b2..f6f4b62 100644 --- a/playbooks/managed-mailcow/update-mailcow.yaml +++ b/playbooks/managed-mailcow/update-mailcow.yaml @@ -3,7 +3,7 @@ user: tincadmin become: true vars: - github_mailcow_ver: "2026-01" # GitHub Version Tag | Value to compare the current running mailcow version to. + github_mailcow_ver: "2026-03b" # GitHub Version Tag | Value to compare the current running mailcow version to. do_snapshots: true # Set to true to create Proxmox snapshots before updating mailcow debug: true # Or False if you dont' wanna see verbose outputs of role outputs @@ -73,4 +73,4 @@ - import_role: name: roles/docker tasks_from: cleanup-all.yml - when: update_mailcow is changed \ No newline at end of file + when: update_mailcow is changed diff --git a/roles/checkmk-monitoring/defaults/main.yaml b/roles/checkmk-monitoring/defaults/main.yaml new file mode 100644 index 0000000..5ff486d --- /dev/null +++ b/roles/checkmk-monitoring/defaults/main.yaml @@ -0,0 +1,2 @@ +checkmk_agent_plugins_to_remove: + - "docker-mailq-monitoring" \ No newline at end of file diff --git a/roles/checkmk-monitoring/tasks/cleanup-agent-plugins.yaml b/roles/checkmk-monitoring/tasks/cleanup-agent-plugins.yaml new file mode 100644 index 0000000..e71a5d9 --- /dev/null +++ b/roles/checkmk-monitoring/tasks/cleanup-agent-plugins.yaml @@ -0,0 +1,14 @@ +--- +- name: "Find and remove specified Checkmk agent plugins" + block: + - name: "Remove Checkmk agent plugins" + ansible.builtin.file: + path: "/usr/lib/check_mk_agent/local/{{ item }}" + state: absent + loop: "{{ checkmk_agent_plugins_to_remove }}" + when: checkmk_agent_plugins_to_remove is defined + + - name: "Debug: Removed plugins" + ansible.builtin.debug: + msg: "Removed plugins: {{ checkmk_agent_plugins_to_remove }}" + when: checkmk_agent_plugins_to_remove is defined \ No newline at end of file diff --git a/roles/os-updates/tasks/upgrade_packages.yaml b/roles/os-updates/tasks/upgrade_packages.yaml index de63e63..193434c 100644 --- a/roles/os-updates/tasks/upgrade_packages.yaml +++ b/roles/os-updates/tasks/upgrade_packages.yaml @@ -4,6 +4,10 @@ update_cache: yes notify: - apt cleanup + retries: 3 + delay: 10 + register: apt_result + until: apt_result is succeeded - name: Check if a kernel update has been installed shell: | diff --git a/roles/proxmox-automation/tasks/create-snapshots.yaml b/roles/proxmox-automation/tasks/create-snapshots.yaml index 3fd6a93..4b82aaa 100644 --- a/roles/proxmox-automation/tasks/create-snapshots.yaml +++ b/roles/proxmox-automation/tasks/create-snapshots.yaml @@ -8,4 +8,9 @@ state: present snapname: "{{ snapshot_name | default('before_update') }}" retention: 2 + timeout: 300 delegate_to: localhost + retries: 3 + delay: 10 + register: snapshot_result + until: snapshot_result is succeeded diff --git a/roles/proxmox-automation/tasks/delete-snapshots.yaml b/roles/proxmox-automation/tasks/delete-snapshots.yaml index d7238e9..360f8e8 100644 --- a/roles/proxmox-automation/tasks/delete-snapshots.yaml +++ b/roles/proxmox-automation/tasks/delete-snapshots.yaml @@ -7,6 +7,9 @@ vmid: "{{ vmid }}" register: snapshot_info delegate_to: localhost + retries: 3 + delay: 10 + until: snapshot_info is succeeded - name: Delete all snapshots community.proxmox.proxmox_snap: @@ -19,4 +22,8 @@ snapname: "{{ item.name }}" loop: "{{ snapshot_info.snapshots }}" when: item.name != "current" - delegate_to: localhost \ No newline at end of file + delegate_to: localhost + retries: 3 + delay: 10 + until: item is succeeded + timeout: 300 \ No newline at end of file diff --git a/roles/proxmox-automation/tasks/get-vmid.yaml b/roles/proxmox-automation/tasks/get-vmid.yaml index 8bd407c..cfd039a 100644 --- a/roles/proxmox-automation/tasks/get-vmid.yaml +++ b/roles/proxmox-automation/tasks/get-vmid.yaml @@ -9,6 +9,10 @@ config: current register: vm_info delegate_to: localhost + retries: 3 + delay: 10 + until: vm_info is succeeded + timeout: 60 - name: Extract VMID ansible.builtin.set_fact: