Add update-hosts.yml

This commit is contained in:
2026-01-22 10:35:12 -05:00
parent a7db4b3dea
commit 01da4c7456

32
update-hosts.yml Normal file
View File

@@ -0,0 +1,32 @@
---
- hosts: hosts
become: yes
tasks:
- name: Apt Update
ansible.builtin.apt:
update_cache: true
- name: Apt Dist-Upgrade
ansible.builtin.apt:
dist-upgrade: yes
update_cache: yes
- name: Apt Autoremove
ansible.builtin.apt:
autoremove: yes
- name: Apt Autoclean
ansible.builtin.apt:
autoclean: true
- name: Check if patchmon agent exists
ansible.builtin.stat:
path: /usr/local/bin/patchmon-agent
register: patchmon_agent
- name: Patchmon agent update
ansible.builtin.command: /usr/local/bin/patchmon-agent report
when: patchmon_agent.stat.exists
changed_when: false
failed_when: false