Files
OCI_Build/playbooks/update_ansible_host.yml
T
2026-03-23 20:02:20 +00:00

26 lines
649 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"
become: true
- 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
become: true