From: Kienan Stewart Date: Mon, 7 Oct 2024 13:27:17 +0000 (-0400) Subject: ansible: Add flag to disable upgrades when updating CI nodes X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=59ec482e523d1449f63ba9ae6c26547205a0aae4;p=lttng-ci.git ansible: Add flag to disable upgrades when updating CI nodes This play defaults to "true", since the normal ansible playbook (`site.yml`) can be used to install new packages and configuration without running the package upgrades. Change-Id: Ifcdce209f7cac1cc72ca27e5ad3d3f150793fdfc Signed-off-by: Kienan Stewart --- diff --git a/automation/ansible/playbooks/update-node.yml b/automation/ansible/playbooks/update-node.yml index 664b745..aa90087 100644 --- a/automation/ansible/playbooks/update-node.yml +++ b/automation/ansible/playbooks/update-node.yml @@ -3,12 +3,14 @@ vars: - job_wait_to_end: true - job_abort: false + - upgrade: true - wait_for_changes: true tasks: - name: Initialize variables ansible.builtin.set_fact: job_wait_to_end: "{{job_wait_to_end}}" job_abort: "{{job_abort}}" + upgrade: "{{upgrade}}" wait_for_changes: "{{wait_for_changes}}" - name: Disable {{ansible_hostname}} in Jenkins @@ -27,33 +29,35 @@ delegate_to: localhost retries: 3 - - name: Update apt cache - when: ansible_os_family == 'Debian' - ansible.builtin.apt: - state: latest - update_cache: true - upgrade: yes + - 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 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 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 + - 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:!node_standalone` or similar, then # this play errors out trying to find variables for the ci-hosts even if the condition