From: Kienan Stewart Date: Mon, 7 Oct 2024 13:28:17 +0000 (-0400) Subject: ansible: Add flag to snapshot-rootnode to run package upgrades X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=21be78c438f59affadb9fb6cf173ebcebf3c4bd0;p=lttng-ci.git ansible: Add flag to snapshot-rootnode to run package upgrades This defaults to false because the snapshot-rootnode needs to be run anytime any configuration changes are made, and doing package upgrades is not always desired. Change-Id: Id1ab8dcd44c5e7172949bf251252cd6348e1f1c3 Signed-off-by: Kienan Stewart --- diff --git a/automation/ansible/playbooks/snapshot-rootnode.yml b/automation/ansible/playbooks/snapshot-rootnode.yml index 91809a7..da57122 100644 --- a/automation/ansible/playbooks/snapshot-rootnode.yml +++ b/automation/ansible/playbooks/snapshot-rootnode.yml @@ -8,6 +8,7 @@ # Set to false when taking the first snapshot of a new rootnode - revert_before: true - snapshot_name: 'base-configuration' + - upgrade: false - wait_for_changes: true tasks: - ansible.builtin.set_fact: @@ -16,6 +17,7 @@ revert_before: "{{revert_before}}" snapshot_name: "{{snapshot_name}}" target_rootnode: "{{inventory_hostname}}" + upgrade: "{{upgrade}}" wait_for_changes: "{{wait_for_changes}}" - name: Shutdown and revert @@ -59,6 +61,36 @@ timeout=300 state=started + - when: upgrade + block: + - name: Update apt cache + when: ansible_os_family == 'Debian' + ansible.builtin.apt: + state: latest + update_cache: true + upgrade: yes + + - name: Update dnf + when: ansible_os_family in ['RedHat', 'Rocky'] + ansible.builtin.dnf: + state: latest + update_cache: true + update_only: true + + - name: Update zypper + when: ansible_os_family == 'Suse' + ansible.builtin.zypper: + name: '*' + state: latest + update_cache: true + + - name: Update apk + when: ansible_os_family == 'Alpine' + ansible.builtin.apk: + state: latest + update_cache: true + upgrade: true + # If the playbook isn't run with `-l node_standalone` or `-l ci-rootnode...`, then # this play errors out trying to find variables for the ci-hosts even if the condition # `inventory_hostname in groups.node_standalone` is false.