dc0819bb05
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>
24 lines
611 B
YAML
24 lines
611 B
YAML
---
|
|
- 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
|