Add in place os upgrade for Debian and Ubuntu

This commit is contained in:
2026-08-11 00:08:41 -05:00
parent 0e18e3bdbb
commit 8240771758
9 changed files with 185 additions and 42 deletions
+18 -42
View File
@@ -62,49 +62,25 @@
notify:
- Ensure_Os_Upgrade.Package_Facts
- Ensure_Os_Upgrade.Service_Facts
- name: Ensure System-upgrade Download
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["distribution"] == 'Fedora'
- ensure_os_upgrade is defined
- ensure_os_upgrade.package_list is defined
- ensure_os_upgrade.package_list is iterable
- ensure_os_upgrade.target_version is defined
- ansible_facts["distribution_major_version"]|int < ensure_os_upgrade.target_version|int
ansible.builtin.shell: >
dnf -y system-upgrade download --refresh --releasever={{ ensure_os_upgrade.target_version|int }}
- name: Ensure System-upgrade Reboot
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["distribution"] == 'Fedora'
- ensure_os_upgrade is defined
- ensure_os_upgrade.package_list is defined
- ensure_os_upgrade.package_list is iterable
- ensure_os_upgrade.target_version is defined
- ansible_facts["distribution_major_version"]|int < ensure_os_upgrade.target_version|int
async: 1
poll: 0
ansible.builtin.shell: >
sleep 5 && dnf -y system-upgrade reboot
- name: Wait For The Reboot
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["distribution"] == 'Fedora'
- ensure_os_upgrade is defined
- ensure_os_upgrade.package_list is defined
- ensure_os_upgrade.package_list is iterable
- ensure_os_upgrade.target_version is defined
- ansible_facts["distribution_major_version"]|int < ensure_os_upgrade.target_version|int
ansible.builtin.wait_for:
connect_timeout: '5'
delay: '300'
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
port: '22'
search_regex: OpenSSH
sleep: '15'
timeout: '1800'
- name: Include Vendor / Version Specific Tasks
when: ["ansible_facts[\"system\"] == 'Linux'"]
ansible.builtin.include_tasks:
file: '{{ lookup("first_found", findme) }}'
vars:
ansible_connection: local
findme:
files:
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"]
}}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"]
}}-default.yml'
- '{{ ansible_facts["distribution"] }}-default.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"]
}}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"]
}}-default.yml'
- '{{ ansible_facts["os_family"] }}-default.yml'
- default.yml
errors: ignore
- name: Gather Facts
ansible.builtin.setup:
notify: