From 7488a288bf7312f3b39bc15d37b2020b4d38b542 Mon Sep 17 00:00:00 2001 From: AnsibleRoles <> Date: Sun, 28 Mar 2021 04:03:44 +0000 Subject: [PATCH 01/33] Initial commit --- .gitignore | 97 +++++++++++++++++++++++++++++++ LICENSE | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 + 3 files changed, 262 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a6ae95 --- /dev/null +++ b/.gitignore @@ -0,0 +1,97 @@ +# ---> Ansible +*.retry + +# ---> Windows +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ---> Linux +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# ---> macOS +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# ---> Vim +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# ---> VisualStudioCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1344add --- /dev/null +++ b/LICENSE @@ -0,0 +1,163 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms +and conditions of version 3 of the GNU General Public License, supplemented +by the additional permissions listed below. + + 0. Additional Definitions. + + + +As used herein, "this License" refers to version 3 of the GNU Lesser General +Public License, and the "GNU GPL" refers to version 3 of the GNU General Public +License. + + + +"The Library" refers to a covered work governed by this License, other than +an Application or a Combined Work as defined below. + + + +An "Application" is any work that makes use of an interface provided by the +Library, but which is not otherwise based on the Library. Defining a subclass +of a class defined by the Library is deemed a mode of using an interface provided +by the Library. + + + +A "Combined Work" is a work produced by combining or linking an Application +with the Library. The particular version of the Library with which the Combined +Work was made is also called the "Linked Version". + + + +The "Minimal Corresponding Source" for a Combined Work means the Corresponding +Source for the Combined Work, excluding any source code for portions of the +Combined Work that, considered in isolation, are based on the Application, +and not on the Linked Version. + + + +The "Corresponding Application Code" for a Combined Work means the object +code and/or source code for the Application, including any data and utility +programs needed for reproducing the Combined Work from the Application, but +excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License without +being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a facility +refers to a function or data to be supplied by an Application that uses the +facility (other than as an argument passed when the facility is invoked), +then you may convey a copy of the modified version: + +a) under this License, provided that you make a good faith effort to ensure +that, in the event an Application does not supply the function or data, the +facility still operates, and performs whatever part of its purpose remains +meaningful, or + +b) under the GNU GPL, with none of the additional permissions of this License +applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a header +file that is part of the Library. You may convey such object code under terms +of your choice, provided that, if the incorporated material is not limited +to numerical parameters, data structure layouts and accessors, or small macros, +inline functions and templates (ten or fewer lines in length), you do both +of the following: + +a) Give prominent notice with each copy of the object code that the Library +is used in it and that the Library and its use are covered by this License. + +b) Accompany the object code with a copy of the GNU GPL and this license document. + + 4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken together, +effectively do not restrict modification of the portions of the Library contained +in the Combined Work and reverse engineering for debugging such modifications, +if you also do each of the following: + +a) Give prominent notice with each copy of the Combined Work that the Library +is used in it and that the Library and its use are covered by this License. + +b) Accompany the Combined Work with a copy of the GNU GPL and this license +document. + +c) For a Combined Work that displays copyright notices during execution, include +the copyright notice for the Library among these notices, as well as a reference +directing the user to the copies of the GNU GPL and this license document. + + d) Do one of the following: + +0) Convey the Minimal Corresponding Source under the terms of this License, +and the Corresponding Application Code in a form suitable for, and under terms +that permit, the user to recombine or relink the Application with a modified +version of the Linked Version to produce a modified Combined Work, in the +manner specified by section 6 of the GNU GPL for conveying Corresponding Source. + +1) Use a suitable shared library mechanism for linking with the Library. A +suitable mechanism is one that (a) uses at run time a copy of the Library +already present on the user's computer system, and (b) will operate properly +with a modified version of the Library that is interface-compatible with the +Linked Version. + +e) Provide Installation Information, but only if you would otherwise be required +to provide such information under section 6 of the GNU GPL, and only to the +extent that such information is necessary to install and execute a modified +version of the Combined Work produced by recombining or relinking the Application +with a modified version of the Linked Version. (If you use option 4d0, the +Installation Information must accompany the Minimal Corresponding Source and +Corresponding Application Code. If you use option 4d1, you must provide the +Installation Information in the manner specified by section 6 of the GNU GPL +for conveying Corresponding Source.) + + 5. Combined Libraries. + +You may place library facilities that are a work based on the Library side +by side in a single library together with other library facilities that are +not Applications and are not covered by this License, and convey such a combined +library under terms of your choice, if you do both of the following: + +a) Accompany the combined library with a copy of the same work based on the +Library, uncombined with any other library facilities, conveyed under the +terms of this License. + +b) Give prominent notice with the combined library that part of it is a work +based on the Library, and explaining where to find the accompanying uncombined +form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions of the +GNU Lesser General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to address +new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you +received it specifies that a certain numbered version of the GNU Lesser General +Public License "or any later version" applies to it, you have the option of +following the terms and conditions either of that published version or of +any later version published by the Free Software Foundation. If the Library +as you received it does not specify a version number of the GNU Lesser General +Public License, you may choose any version of the GNU Lesser General Public +License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether +future versions of the GNU Lesser General Public License shall apply, that +proxy's public statement of acceptance of any version is permanent authorization +for you to choose that version for the Library. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d6b31a6 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# ensure_os_upgrade + From 037253ee1b5dbf0735faf55e68ff2b47d8fa11d4 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 27 Mar 2021 23:07:49 -0500 Subject: [PATCH 02/33] Initial Ansible Role --- README.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6b31a6..225dd44 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,38 @@ -# ensure_os_upgrade +Role Name +========= +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). From ce80b85a5d541ee7cb76d796ce1b47f5d43795b7 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 27 Mar 2021 23:08:41 -0500 Subject: [PATCH 03/33] Initial Ansible Role --- .travis.yml | 29 ++++++++++++++++++++++++++ defaults/main.yml | 2 ++ handlers/main.yml | 2 ++ meta/main.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++++ tasks/main.yml | 2 ++ tests/inventory | 2 ++ tests/test.yml | 5 +++++ vars/main.yml | 2 ++ 8 files changed, 97 insertions(+) create mode 100644 .travis.yml create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/main.yml create mode 100644 tests/inventory create mode 100644 tests/test.yml create mode 100644 vars/main.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..44a0374 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for ensure_os_upgrade \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..d7140f4 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for ensure_os_upgrade \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..227ad9c --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,53 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.9 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. + \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..14ce16c --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,2 @@ +--- +# tasks file for ensure_os_upgrade \ No newline at end of file diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..560d3e0 --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ensure_os_upgrade \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..d632f23 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for ensure_os_upgrade \ No newline at end of file From f0c6d3fc6d3516e8acb42431d920305933d3c489 Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:10:14 +0000 Subject: [PATCH 04/33] Set the default target Fedora to upgrade to --- defaults/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 44a0374..99ec6d1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,3 @@ --- -# defaults file for ensure_os_upgrade \ No newline at end of file +# defaults file for ensure_os_upgrade +target_fedora_release: '32' \ No newline at end of file From 5e26955b105aacd1e45abec35e2efb45259402e1 Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:11:57 +0000 Subject: [PATCH 05/33] Setup default handlers to gather facts --- handlers/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/handlers/main.yml b/handlers/main.yml index d7140f4..659d0f5 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,2 +1,6 @@ --- -# handlers file for ensure_os_upgrade \ No newline at end of file +# handlers file for ensure_os_upgrade +- name: 'ensure_os_upgrade.package_facts' + ansible.builtin.package_facts: +- name: 'ensure_os_upgrade.service_facts' + ansible.builtin.service_facts: \ No newline at end of file From 91942f96d37639041bc12a48ab3ac97f8be62eed Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:16:53 +0000 Subject: [PATCH 06/33] Define basic role feature --- tasks/main.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 14ce16c..ad391dc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,68 @@ --- -# tasks file for ensure_os_upgrade \ No newline at end of file +# tasks file for ensure_os_upgrade +- name: 'include variables' + when: + - ansible_system == 'Linux' + include_vars: + file: '{{ lookup("first_found", findme ) }}' + name: 'ensure_os_upgrade' + vars: + findme: + files: + - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml' + - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-default.yml' + - '{{ ansible_distribution }}-default.yml' + - '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml' + - '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-default.yml' + - '{{ ansible_os_family }}-default.yml' + - 'default.yml' + paths: + - '../vars/' + errors: 'ignore' +- name: 'package discovery' + when: + - ansible_system == 'Linux' + - packages is not defined + ansible.builtin.package_facts: +- name: 'service discovery' + when: + - ansible_system == 'Linux' + - services is not defined + ansible.builtin.service_facts: + - name: 'ensure packages' + when: + - ansible_system == 'Linux' + - ensure_os_upgrade is defined + - ensure_os_upgrade.package_list is defined + - ensure_os_upgrade.package_list is iterable + - packages[item.name] is not defined + ansible.builtin.package: + name: '{{ item.name }}' + state: '{{ item.state }}' + loop: '{{ ensure_os_upgrade.package_list }}' + loop_control: + label: '{{ item.name }} will be {{ item.state }}' + notify: + - 'ensure_os_upgrade.package_facts' + - 'ensure_os_upgrade.service_facts' +- name: 'ensure services' + when: + - ansible_system == 'Linux' + - ensure_os_upgrade is defined + - ensure_os_upgrade.service_list is defined + - ensure_os_upgrade.service_list is iterable + ansible.builtin.service: + enabled: '{{ item.enabled }}' + name: '{{ item.name }}' + state: '{{ item.state }}' + loop: '{{ ensure_os_upgrade.service_list }}' + loop_control: + label: '{{ item.name }} will be {{ item.state }}' + notify: + - 'ensure_os_upgrade.package_facts' + - 'ensure_os_upgrade.service_facts' + + + +- name: 'flush handlers' + meta: 'flush_handlers' \ No newline at end of file From f89ab881c8df7e55e1f3115ea416333c343d8893 Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:26:13 +0000 Subject: [PATCH 07/33] Add default OS/Vendor config of do nothing --- vars/default.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 vars/default.yml diff --git a/vars/default.yml b/vars/default.yml new file mode 100644 index 0000000..d632f23 --- /dev/null +++ b/vars/default.yml @@ -0,0 +1,2 @@ +--- +# vars file for ensure_os_upgrade \ No newline at end of file From c30a17c1355c8079356ae7c42d083fadbffec90c Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:28:03 +0000 Subject: [PATCH 08/33] Enable Fedora 32 to upgrade --- vars/Fedora-32-default.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 vars/Fedora-32-default.yml diff --git a/vars/Fedora-32-default.yml b/vars/Fedora-32-default.yml new file mode 100644 index 0000000..77275f2 --- /dev/null +++ b/vars/Fedora-32-default.yml @@ -0,0 +1,5 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' \ No newline at end of file From db67e85974b330ba60ebf589fb0d04729cf3bed4 Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:29:15 +0000 Subject: [PATCH 09/33] Enable Fedora 31 to upgrade --- vars/Fedora-31-default.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 vars/Fedora-31-default.yml diff --git a/vars/Fedora-31-default.yml b/vars/Fedora-31-default.yml new file mode 100644 index 0000000..77275f2 --- /dev/null +++ b/vars/Fedora-31-default.yml @@ -0,0 +1,5 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' \ No newline at end of file From c0f8ab965f2661e7ab3fc132c0b7338235616f6d Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:29:37 +0000 Subject: [PATCH 10/33] Enable Fedora 30 to upgrade --- vars/Fedora-30-default.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 vars/Fedora-30-default.yml diff --git a/vars/Fedora-30-default.yml b/vars/Fedora-30-default.yml new file mode 100644 index 0000000..77275f2 --- /dev/null +++ b/vars/Fedora-30-default.yml @@ -0,0 +1,5 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' \ No newline at end of file From 798a6ef5fbf587fb2662f59e2c51b7ad799be833 Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:38:25 +0000 Subject: [PATCH 11/33] If we know how to upgrade Fedora via DNF... do it. --- tasks/main.yml | 51 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index ad391dc..a585468 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -61,8 +61,53 @@ notify: - 'ensure_os_upgrade.package_facts' - 'ensure_os_upgrade.service_facts' - - - +- name: 'Ensure system-upgrade download' + when: + - ansible_system == 'Linux' + - ansible_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_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_system == 'Linux' + - ansible_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_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_system == 'Linux' + - ansible_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_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' + vars: + ansible_connection: 'local' +- name: 'Gather facts' + ansible.builtin.setup: + notify: + - 'ensure_os_upgrade.package_facts' + - 'ensure_os_upgrade.service_facts' - name: 'flush handlers' meta: 'flush_handlers' \ No newline at end of file From 96deffb0a0425747b6370a9d49c641b69c6119dd Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:39:05 +0000 Subject: [PATCH 12/33] Remove default targets --- defaults/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 99ec6d1..44a0374 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,2 @@ --- -# defaults file for ensure_os_upgrade -target_fedora_release: '32' \ No newline at end of file +# defaults file for ensure_os_upgrade \ No newline at end of file From f53e45fdcf737a1c213615456a3be5055381ac3a Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:39:34 +0000 Subject: [PATCH 13/33] Ensure Fedora 30 can only upgrade to 31 --- vars/Fedora-30-default.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vars/Fedora-30-default.yml b/vars/Fedora-30-default.yml index 77275f2..aae65e0 100644 --- a/vars/Fedora-30-default.yml +++ b/vars/Fedora-30-default.yml @@ -2,4 +2,5 @@ # vars file for ensure_os_upgrade package_list: - name: 'dnf-plugin-system-upgrade' - state: 'present' \ No newline at end of file + state: 'present' +target_version: '31' \ No newline at end of file From 0525f968133a9b792e7d31bb902dcc6109c36034 Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:39:55 +0000 Subject: [PATCH 14/33] Ensure Fedora 31 can only upgrade to 32 --- vars/Fedora-31-default.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vars/Fedora-31-default.yml b/vars/Fedora-31-default.yml index 77275f2..8755957 100644 --- a/vars/Fedora-31-default.yml +++ b/vars/Fedora-31-default.yml @@ -2,4 +2,5 @@ # vars file for ensure_os_upgrade package_list: - name: 'dnf-plugin-system-upgrade' - state: 'present' \ No newline at end of file + state: 'present' +target_version: '32' \ No newline at end of file From e751683ee9f65b63dbfb2f57c17a37f0161553c0 Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:40:15 +0000 Subject: [PATCH 15/33] Ensure Fedora 32 can only upgrade to 33 --- vars/Fedora-32-default.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vars/Fedora-32-default.yml b/vars/Fedora-32-default.yml index 77275f2..1b92c1f 100644 --- a/vars/Fedora-32-default.yml +++ b/vars/Fedora-32-default.yml @@ -2,4 +2,5 @@ # vars file for ensure_os_upgrade package_list: - name: 'dnf-plugin-system-upgrade' - state: 'present' \ No newline at end of file + state: 'present' +target_version: '33' \ No newline at end of file From fec62a58feb3a19b631ee246c8e583e2926b5a7d Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 04:43:40 +0000 Subject: [PATCH 16/33] Fix indentation syntax error --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index a585468..e539502 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -29,7 +29,7 @@ - ansible_system == 'Linux' - services is not defined ansible.builtin.service_facts: - - name: 'ensure packages' +- name: 'ensure packages' when: - ansible_system == 'Linux' - ensure_os_upgrade is defined From 6d5b7e7d33ece6e323145c7088d6bb3bb9f0b4c6 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 27 Mar 2021 23:58:14 -0500 Subject: [PATCH 17/33] Enable Fedora 23-29 to upgrade via DNF --- vars/Fedora-23-default.yml | 6 ++++++ vars/Fedora-24-default.yml | 6 ++++++ vars/Fedora-25-default.yml | 6 ++++++ vars/Fedora-26-default.yml | 6 ++++++ vars/Fedora-27-default.yml | 6 ++++++ vars/Fedora-28-default.yml | 6 ++++++ vars/Fedora-29-default.yml | 6 ++++++ 7 files changed, 42 insertions(+) create mode 100644 vars/Fedora-23-default.yml create mode 100644 vars/Fedora-24-default.yml create mode 100644 vars/Fedora-25-default.yml create mode 100644 vars/Fedora-26-default.yml create mode 100644 vars/Fedora-27-default.yml create mode 100644 vars/Fedora-28-default.yml create mode 100644 vars/Fedora-29-default.yml diff --git a/vars/Fedora-23-default.yml b/vars/Fedora-23-default.yml new file mode 100644 index 0000000..cec3855 --- /dev/null +++ b/vars/Fedora-23-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '24' \ No newline at end of file diff --git a/vars/Fedora-24-default.yml b/vars/Fedora-24-default.yml new file mode 100644 index 0000000..515d8c4 --- /dev/null +++ b/vars/Fedora-24-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '25' \ No newline at end of file diff --git a/vars/Fedora-25-default.yml b/vars/Fedora-25-default.yml new file mode 100644 index 0000000..aa3c3c6 --- /dev/null +++ b/vars/Fedora-25-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '26' \ No newline at end of file diff --git a/vars/Fedora-26-default.yml b/vars/Fedora-26-default.yml new file mode 100644 index 0000000..7d6232b --- /dev/null +++ b/vars/Fedora-26-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '27' \ No newline at end of file diff --git a/vars/Fedora-27-default.yml b/vars/Fedora-27-default.yml new file mode 100644 index 0000000..9d43aa3 --- /dev/null +++ b/vars/Fedora-27-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '28' \ No newline at end of file diff --git a/vars/Fedora-28-default.yml b/vars/Fedora-28-default.yml new file mode 100644 index 0000000..925ad30 --- /dev/null +++ b/vars/Fedora-28-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '29' \ No newline at end of file diff --git a/vars/Fedora-29-default.yml b/vars/Fedora-29-default.yml new file mode 100644 index 0000000..fddaa43 --- /dev/null +++ b/vars/Fedora-29-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '30' \ No newline at end of file From d31dfe0469d21028ecfbba5e445abac446b3851e Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 05:02:16 +0000 Subject: [PATCH 18/33] Disable warnings on dnf system-upgrade plugin calls --- tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index e539502..3a56346 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -70,6 +70,7 @@ - ensure_os_upgrade.package_list is iterable - ensure_os_upgrade.target_version is defined - ansible_distribution_major_version|int < ensure_os_upgrade.target_version|int + warn: 'false' ansible.builtin.shell: > dnf -y system-upgrade download --refresh --releasever={{ ensure_os_upgrade.target_version|int }} - name: 'Ensure system-upgrade reboot' @@ -83,6 +84,7 @@ - ansible_distribution_major_version|int < ensure_os_upgrade.target_version|int async: '1' poll: '0' + warn: 'false' ansible.builtin.shell: > sleep 5 && dnf -y system-upgrade reboot - name: 'Wait for the reboot' From 6135f62e31db834545f6817d47205d0ae7e29fca Mon Sep 17 00:00:00 2001 From: jmrothst Date: Sun, 28 Mar 2021 05:24:30 +0000 Subject: [PATCH 19/33] Remove warn because ansible cannot handle both a warn and ansible.builting.shell ?! --- tasks/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3a56346..e539502 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -70,7 +70,6 @@ - ensure_os_upgrade.package_list is iterable - ensure_os_upgrade.target_version is defined - ansible_distribution_major_version|int < ensure_os_upgrade.target_version|int - warn: 'false' ansible.builtin.shell: > dnf -y system-upgrade download --refresh --releasever={{ ensure_os_upgrade.target_version|int }} - name: 'Ensure system-upgrade reboot' @@ -84,7 +83,6 @@ - ansible_distribution_major_version|int < ensure_os_upgrade.target_version|int async: '1' poll: '0' - warn: 'false' ansible.builtin.shell: > sleep 5 && dnf -y system-upgrade reboot - name: 'Wait for the reboot' From 5deaaad127682281270f0c50a4eb78ac513e6c13 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Mon, 14 Jun 2021 22:37:03 -0500 Subject: [PATCH 20/33] Enable Fedora 33 upgrades to 34 --- vars/Fedora-33-default.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 vars/Fedora-33-default.yml diff --git a/vars/Fedora-33-default.yml b/vars/Fedora-33-default.yml new file mode 100644 index 0000000..d66ae5d --- /dev/null +++ b/vars/Fedora-33-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '34' \ No newline at end of file From 7fea879a4a01d8b10a0cd6d0d1da69a5657580e6 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sun, 25 Jul 2021 03:26:39 +0000 Subject: [PATCH 21/33] Add some flushing of handlers --- tasks/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index e539502..84ffdd1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -45,6 +45,8 @@ notify: - 'ensure_os_upgrade.package_facts' - 'ensure_os_upgrade.service_facts' +- name: 'flush handlers' + meta: 'flush_handlers' - name: 'ensure services' when: - ansible_system == 'Linux' @@ -61,6 +63,8 @@ notify: - 'ensure_os_upgrade.package_facts' - 'ensure_os_upgrade.service_facts' +- name: 'flush handlers' + meta: 'flush_handlers' - name: 'Ensure system-upgrade download' when: - ansible_system == 'Linux' @@ -110,4 +114,4 @@ - 'ensure_os_upgrade.package_facts' - 'ensure_os_upgrade.service_facts' - name: 'flush handlers' - meta: 'flush_handlers' \ No newline at end of file + meta: 'flush_handlers' From 6efa88ec08cf560f743a2a6694c3c6d4bc0a8477 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sun, 25 Jul 2021 03:52:24 +0000 Subject: [PATCH 22/33] Prevent multiple service restarts --- tasks/main.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 84ffdd1..6f92dd9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -45,8 +45,6 @@ notify: - 'ensure_os_upgrade.package_facts' - 'ensure_os_upgrade.service_facts' -- name: 'flush handlers' - meta: 'flush_handlers' - name: 'ensure services' when: - ansible_system == 'Linux' @@ -63,8 +61,6 @@ notify: - 'ensure_os_upgrade.package_facts' - 'ensure_os_upgrade.service_facts' -- name: 'flush handlers' - meta: 'flush_handlers' - name: 'Ensure system-upgrade download' when: - ansible_system == 'Linux' @@ -115,3 +111,4 @@ - 'ensure_os_upgrade.service_facts' - name: 'flush handlers' meta: 'flush_handlers' + From b5c0291a390716e601c84f419c47df18d902d7ba Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sun, 5 Jun 2022 16:29:45 -0500 Subject: [PATCH 23/33] Update handlers --- handlers/main.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/handlers/main.yml b/handlers/main.yml index 659d0f5..4114067 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,4 +3,25 @@ - name: 'ensure_os_upgrade.package_facts' ansible.builtin.package_facts: - name: 'ensure_os_upgrade.service_facts' - ansible.builtin.service_facts: \ No newline at end of file + ansible.builtin.service_facts: +- name: 'ensure_os_upgrade.service_reload' + when: + - ansible_system == 'Linux' + - ansible_service_mgr == 'systemd' + - ensure_os_upgrade is defined + ansible.builtin.systemd: + daemon_reload: 'yes' +- name: 'ensure_os_upgrade.services' + when: + - ansible_system == 'Linux' + - ensure_os_upgrade is defined + - ensure_os_upgrade.service_list is defined + - ensure_os_upgrade.service_list is iterable + - item.state == 'started' + ansible.builtin.service: + enabled: '{{ item.enabled }}' + name: '{{ item.name }}' + state: 'restarted' + loop: '{{ ensure_os_upgrade.service_list }}' + loop_control: + label: '{{ item.name }} will be restarted' From 6af70944cbf1c31d3ef74ae55aeb8af1cf1f3750 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sun, 5 Jun 2022 16:48:11 -0500 Subject: [PATCH 24/33] Update tasks --- tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 6f92dd9..b279035 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -35,7 +35,6 @@ - ensure_os_upgrade is defined - ensure_os_upgrade.package_list is defined - ensure_os_upgrade.package_list is iterable - - packages[item.name] is not defined ansible.builtin.package: name: '{{ item.name }}' state: '{{ item.state }}' From 80f0a2106c7aec060214f5d25a665ee5ffcb79fe Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Tue, 6 Dec 2022 20:38:08 -0600 Subject: [PATCH 25/33] Add Fedora 34/35 upgrade to 35/36 --- vars/Fedora-34-default.yml | 6 ++++++ vars/Fedora-35-default.yml | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 vars/Fedora-34-default.yml create mode 100644 vars/Fedora-35-default.yml diff --git a/vars/Fedora-34-default.yml b/vars/Fedora-34-default.yml new file mode 100644 index 0000000..61f1a40 --- /dev/null +++ b/vars/Fedora-34-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '35' diff --git a/vars/Fedora-35-default.yml b/vars/Fedora-35-default.yml new file mode 100644 index 0000000..f4dcf78 --- /dev/null +++ b/vars/Fedora-35-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '36' From 9c0e3ebaca676c319354fe4c364b8cb0102a8557 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 29 Apr 2023 20:16:25 -0500 Subject: [PATCH 26/33] Fedora 36 to 37 upgrade --- vars/Fedora-36-default.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 vars/Fedora-36-default.yml diff --git a/vars/Fedora-36-default.yml b/vars/Fedora-36-default.yml new file mode 100644 index 0000000..4201534 --- /dev/null +++ b/vars/Fedora-36-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '37' From 94166d042f30f5f23fa9722e9a5fa915c4adedc7 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 29 Apr 2023 20:17:00 -0500 Subject: [PATCH 27/33] Fedora 37 to 38 upgrade --- vars/Fedora-37-default.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 vars/Fedora-37-default.yml diff --git a/vars/Fedora-37-default.yml b/vars/Fedora-37-default.yml new file mode 100644 index 0000000..4e1f436 --- /dev/null +++ b/vars/Fedora-37-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '38' From 3500b5076555f41b9403f4181cd87d32331715ad Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 16 Mar 2024 21:02:48 -0500 Subject: [PATCH 28/33] Add Fedora 38 to 39 --- vars/Fedora-38-default.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 vars/Fedora-38-default.yml diff --git a/vars/Fedora-38-default.yml b/vars/Fedora-38-default.yml new file mode 100644 index 0000000..66324fa --- /dev/null +++ b/vars/Fedora-38-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '39' From 30d8a97bbd7477e962ca14c7d2fe0a5690570376 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Wed, 10 Jul 2024 21:51:31 -0500 Subject: [PATCH 29/33] Upgrade to Fedora 40 Signed-off-by: Jason Rothstein --- vars/Fedora-39-default.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 vars/Fedora-39-default.yml diff --git a/vars/Fedora-39-default.yml b/vars/Fedora-39-default.yml new file mode 100644 index 0000000..0d26389 --- /dev/null +++ b/vars/Fedora-39-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '40' From 6eef317d5cebd44b1fc2790582aaa534f6024c3d Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sun, 27 Apr 2025 12:42:09 -0500 Subject: [PATCH 30/33] Fedora 42 Signed-off-by: Jason Rothstein --- vars/Fedora-40-default.yml | 6 ++++++ vars/Fedora-41-default.yml | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 vars/Fedora-40-default.yml create mode 100644 vars/Fedora-41-default.yml diff --git a/vars/Fedora-40-default.yml b/vars/Fedora-40-default.yml new file mode 100644 index 0000000..1555c62 --- /dev/null +++ b/vars/Fedora-40-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '41' diff --git a/vars/Fedora-41-default.yml b/vars/Fedora-41-default.yml new file mode 100644 index 0000000..040aa25 --- /dev/null +++ b/vars/Fedora-41-default.yml @@ -0,0 +1,6 @@ +--- +# vars file for ensure_os_upgrade +package_list: + - name: 'dnf-plugin-system-upgrade' + state: 'present' +target_version: '42' From 207250479358d38009e799f921dc7e4ad15ace31 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sun, 25 May 2025 20:12:07 -0500 Subject: [PATCH 31/33] Hanlder improvements Signed-off-by: Jason Rothstein --- handlers/main.yml | 4 +++- tasks/main.yml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/handlers/main.yml b/handlers/main.yml index 4114067..b00406b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -11,7 +11,7 @@ - ensure_os_upgrade is defined ansible.builtin.systemd: daemon_reload: 'yes' -- name: 'ensure_os_upgrade.services' +- name: 'ensure_os_upgrade.service_restart' when: - ansible_system == 'Linux' - ensure_os_upgrade is defined @@ -25,3 +25,5 @@ loop: '{{ ensure_os_upgrade.service_list }}' loop_control: label: '{{ item.name }} will be restarted' +... + diff --git a/tasks/main.yml b/tasks/main.yml index b279035..026f9c8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -110,4 +110,5 @@ - 'ensure_os_upgrade.service_facts' - name: 'flush handlers' meta: 'flush_handlers' +... From f868afcd302f325b86633f543bd5127aedaa756a Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Mon, 4 May 2026 21:28:43 -0500 Subject: [PATCH 32/33] Ansible core 2.20 fixes Signed-off-by: Jason Rothstein --- tasks/main.yml | 40 +++++++++++++++++++------------------- vars/Fedora-23-default.yml | 4 +++- vars/Fedora-24-default.yml | 4 +++- vars/Fedora-25-default.yml | 4 +++- vars/Fedora-26-default.yml | 4 +++- vars/Fedora-27-default.yml | 4 +++- vars/Fedora-28-default.yml | 4 +++- vars/Fedora-29-default.yml | 4 +++- vars/Fedora-30-default.yml | 4 +++- vars/Fedora-31-default.yml | 4 +++- vars/Fedora-32-default.yml | 4 +++- vars/Fedora-33-default.yml | 4 +++- vars/Fedora-34-default.yml | 2 ++ vars/Fedora-35-default.yml | 2 ++ vars/Fedora-36-default.yml | 2 ++ vars/Fedora-37-default.yml | 2 ++ vars/Fedora-38-default.yml | 2 ++ vars/Fedora-39-default.yml | 2 ++ vars/Fedora-40-default.yml | 2 ++ vars/Fedora-41-default.yml | 2 ++ 20 files changed, 69 insertions(+), 31 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 026f9c8..34d569f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,36 +2,36 @@ # tasks file for ensure_os_upgrade - name: 'include variables' when: - - ansible_system == 'Linux' + - ansible_facts["system"] == 'Linux' include_vars: file: '{{ lookup("first_found", findme ) }}' name: 'ensure_os_upgrade' vars: findme: files: - - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml' - - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-default.yml' - - '{{ ansible_distribution }}-default.yml' - - '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml' - - '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-default.yml' - - '{{ ansible_os_family }}-default.yml' + - '{{ 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' paths: - '../vars/' errors: 'ignore' - name: 'package discovery' when: - - ansible_system == 'Linux' + - ansible_facts["system"] == 'Linux' - packages is not defined ansible.builtin.package_facts: - name: 'service discovery' when: - - ansible_system == 'Linux' + - ansible_facts["system"] == 'Linux' - services is not defined ansible.builtin.service_facts: - name: 'ensure packages' when: - - ansible_system == 'Linux' + - ansible_facts["system"] == 'Linux' - ensure_os_upgrade is defined - ensure_os_upgrade.package_list is defined - ensure_os_upgrade.package_list is iterable @@ -46,7 +46,7 @@ - 'ensure_os_upgrade.service_facts' - name: 'ensure services' when: - - ansible_system == 'Linux' + - ansible_facts["system"] == 'Linux' - ensure_os_upgrade is defined - ensure_os_upgrade.service_list is defined - ensure_os_upgrade.service_list is iterable @@ -62,37 +62,37 @@ - 'ensure_os_upgrade.service_facts' - name: 'Ensure system-upgrade download' when: - - ansible_system == 'Linux' - - ansible_distribution == 'Fedora' + - 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_distribution_major_version|int < ensure_os_upgrade.target_version|int + - 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_system == 'Linux' - - ansible_distribution == 'Fedora' + - 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_distribution_major_version|int < ensure_os_upgrade.target_version|int + - 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_system == 'Linux' - - ansible_distribution == 'Fedora' + - 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_distribution_major_version|int < ensure_os_upgrade.target_version|int + - ansible_facts["distribution_major_version"]|int < ensure_os_upgrade.target_version|int ansible.builtin.wait_for: connect_timeout: '5' delay: '300' diff --git a/vars/Fedora-23-default.yml b/vars/Fedora-23-default.yml index cec3855..67a86c5 100644 --- a/vars/Fedora-23-default.yml +++ b/vars/Fedora-23-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '24' \ No newline at end of file +target_version: '24' +... + diff --git a/vars/Fedora-24-default.yml b/vars/Fedora-24-default.yml index 515d8c4..ef09772 100644 --- a/vars/Fedora-24-default.yml +++ b/vars/Fedora-24-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '25' \ No newline at end of file +target_version: '25' +... + diff --git a/vars/Fedora-25-default.yml b/vars/Fedora-25-default.yml index aa3c3c6..bb21b98 100644 --- a/vars/Fedora-25-default.yml +++ b/vars/Fedora-25-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '26' \ No newline at end of file +target_version: '26' +... + diff --git a/vars/Fedora-26-default.yml b/vars/Fedora-26-default.yml index 7d6232b..640c176 100644 --- a/vars/Fedora-26-default.yml +++ b/vars/Fedora-26-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '27' \ No newline at end of file +target_version: '27' +... + diff --git a/vars/Fedora-27-default.yml b/vars/Fedora-27-default.yml index 9d43aa3..a22caa9 100644 --- a/vars/Fedora-27-default.yml +++ b/vars/Fedora-27-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '28' \ No newline at end of file +target_version: '28' +... + diff --git a/vars/Fedora-28-default.yml b/vars/Fedora-28-default.yml index 925ad30..f56c8dc 100644 --- a/vars/Fedora-28-default.yml +++ b/vars/Fedora-28-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '29' \ No newline at end of file +target_version: '29' +... + diff --git a/vars/Fedora-29-default.yml b/vars/Fedora-29-default.yml index fddaa43..30f5b0b 100644 --- a/vars/Fedora-29-default.yml +++ b/vars/Fedora-29-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '30' \ No newline at end of file +target_version: '30' +... + diff --git a/vars/Fedora-30-default.yml b/vars/Fedora-30-default.yml index aae65e0..ca5c1f5 100644 --- a/vars/Fedora-30-default.yml +++ b/vars/Fedora-30-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '31' \ No newline at end of file +target_version: '31' +... + diff --git a/vars/Fedora-31-default.yml b/vars/Fedora-31-default.yml index 8755957..010d3a8 100644 --- a/vars/Fedora-31-default.yml +++ b/vars/Fedora-31-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '32' \ No newline at end of file +target_version: '32' +... + diff --git a/vars/Fedora-32-default.yml b/vars/Fedora-32-default.yml index 1b92c1f..c6a6339 100644 --- a/vars/Fedora-32-default.yml +++ b/vars/Fedora-32-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '33' \ No newline at end of file +target_version: '33' +... + diff --git a/vars/Fedora-33-default.yml b/vars/Fedora-33-default.yml index d66ae5d..3df841d 100644 --- a/vars/Fedora-33-default.yml +++ b/vars/Fedora-33-default.yml @@ -3,4 +3,6 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' -target_version: '34' \ No newline at end of file +target_version: '34' +... + diff --git a/vars/Fedora-34-default.yml b/vars/Fedora-34-default.yml index 61f1a40..2e2e6ec 100644 --- a/vars/Fedora-34-default.yml +++ b/vars/Fedora-34-default.yml @@ -4,3 +4,5 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' target_version: '35' +... + diff --git a/vars/Fedora-35-default.yml b/vars/Fedora-35-default.yml index f4dcf78..9c29e23 100644 --- a/vars/Fedora-35-default.yml +++ b/vars/Fedora-35-default.yml @@ -4,3 +4,5 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' target_version: '36' +... + diff --git a/vars/Fedora-36-default.yml b/vars/Fedora-36-default.yml index 4201534..80053f4 100644 --- a/vars/Fedora-36-default.yml +++ b/vars/Fedora-36-default.yml @@ -4,3 +4,5 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' target_version: '37' +... + diff --git a/vars/Fedora-37-default.yml b/vars/Fedora-37-default.yml index 4e1f436..c53b215 100644 --- a/vars/Fedora-37-default.yml +++ b/vars/Fedora-37-default.yml @@ -4,3 +4,5 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' target_version: '38' +... + diff --git a/vars/Fedora-38-default.yml b/vars/Fedora-38-default.yml index 66324fa..31b1c1a 100644 --- a/vars/Fedora-38-default.yml +++ b/vars/Fedora-38-default.yml @@ -4,3 +4,5 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' target_version: '39' +... + diff --git a/vars/Fedora-39-default.yml b/vars/Fedora-39-default.yml index 0d26389..ae00741 100644 --- a/vars/Fedora-39-default.yml +++ b/vars/Fedora-39-default.yml @@ -4,3 +4,5 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' target_version: '40' +... + diff --git a/vars/Fedora-40-default.yml b/vars/Fedora-40-default.yml index 1555c62..dceeb07 100644 --- a/vars/Fedora-40-default.yml +++ b/vars/Fedora-40-default.yml @@ -4,3 +4,5 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' target_version: '41' +... + diff --git a/vars/Fedora-41-default.yml b/vars/Fedora-41-default.yml index 040aa25..e0fbbfb 100644 --- a/vars/Fedora-41-default.yml +++ b/vars/Fedora-41-default.yml @@ -4,3 +4,5 @@ package_list: - name: 'dnf-plugin-system-upgrade' state: 'present' target_version: '42' +... + From c8aee3dfa2c70d1a584486e2f87990aef26613ef Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Mon, 4 May 2026 22:06:46 -0500 Subject: [PATCH 33/33] More ansible core 2.20 fixes Signed-off-by: Jason Rothstein --- tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 34d569f..ca79176 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -22,12 +22,12 @@ - name: 'package discovery' when: - ansible_facts["system"] == 'Linux' - - packages is not defined + - ansible_facts["packages"] is not defined ansible.builtin.package_facts: - name: 'service discovery' when: - ansible_facts["system"] == 'Linux' - - services is not defined + - ansible_facts["services"] is not defined ansible.builtin.service_facts: - name: 'ensure packages' when: