Add update_ansible_host.yml playbook
Dedicated playbook for updating the Ansible control node separately from the bulk update_upgrade.yml which excludes AnsibleHost. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: Update and upgrade Ansible host
|
||||
hosts: AnsibleHost
|
||||
become: true
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Update and upgrade apt packages
|
||||
apt:
|
||||
update_cache: yes
|
||||
upgrade: safe
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Check if reboot is required
|
||||
ansible.builtin.stat:
|
||||
path: /var/run/reboot-required
|
||||
get_checksum: no
|
||||
register: reboot_required_file
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Reboot if required
|
||||
ansible.builtin.reboot:
|
||||
when: reboot_required_file is defined and reboot_required_file.stat.exists
|
||||
Reference in New Issue
Block a user