From 2cfcab54114799ef612c59a04e537d8c44438814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Fri, 8 Nov 2024 17:46:06 +0100 Subject: feat(roles/upgrade): kickstart upgrade role for openbsd --- roles/upgrade/tasks/main.yml | 18 ++++++++++++++++++ site.all.yml | 6 ++++++ site.prerequisites.yml | 6 ++++++ site.system.yml | 5 ----- site.upgrade.yml | 6 ++++++ 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 roles/upgrade/tasks/main.yml create mode 100644 site.prerequisites.yml create mode 100644 site.upgrade.yml diff --git a/roles/upgrade/tasks/main.yml b/roles/upgrade/tasks/main.yml new file mode 100644 index 0000000..c8a041b --- /dev/null +++ b/roles/upgrade/tasks/main.yml @@ -0,0 +1,18 @@ +--- + +- name: apply system upgrade + community.general.sysupgrade: + register: upgrade__result_sysupgrade + +- name: reboot to apply upgrade + ansible.builtin.reboot: + reboot_timeout: 1200 + when: upgrade__result_sysupgrade.changed + +- name: apply post-upgrade update + ansible.builtin.command: pkg_add -Uu + when: upgrade__result_sysupgrade.changed + +- name: update dependencies + ansible.builtin.include_role: + name: update diff --git a/site.all.yml b/site.all.yml index 73acbef..83a35c7 100644 --- a/site.all.yml +++ b/site.all.yml @@ -1,5 +1,11 @@ --- +- name: include prerequisites playbook + ansible.builtin.import_playbook: site.prerequisites.yml + +- name: include upgrade playbook + ansible.builtin.import_playbook: site.upgrade.yml + - name: include system playbook ansible.builtin.import_playbook: site.system.yml diff --git a/site.prerequisites.yml b/site.prerequisites.yml new file mode 100644 index 0000000..1acc3fa --- /dev/null +++ b/site.prerequisites.yml @@ -0,0 +1,6 @@ +--- + +- hosts: servers + gather_facts: false + roles: + - role: prerequisites diff --git a/site.system.yml b/site.system.yml index 721d244..8c08624 100644 --- a/site.system.yml +++ b/site.system.yml @@ -1,10 +1,5 @@ --- -- hosts: servers - gather_facts: false - roles: - - role: prerequisites - - hosts: servers roles: - role: hostname diff --git a/site.upgrade.yml b/site.upgrade.yml new file mode 100644 index 0000000..d635140 --- /dev/null +++ b/site.upgrade.yml @@ -0,0 +1,6 @@ +--- + +- hosts: servers + roles: + - role: upgrade + when: ansible_distribution == "OpenBSD" -- cgit v1.2.3