From 2e837a7adad142dbfa1767ffa00f587203136e18 Mon Sep 17 00:00:00 2001 From: ohayak Date: Tue, 27 Aug 2024 11:34:40 +0200 Subject: [PATCH] Install AWS CLI with --update flag When using an AMI with aws CLI already the process fails due to this error: ``` amazon-ebs.ubuntu-22.04: fatal: [default]: FAILED! => {"changed": true, "cmd": ["/tmp/aws/install", "-i", "/usr/local/aws-cli", "-b", "/usr/local/sbin"], "delta": "0:00:01.067315", "end": "2024-08-26 23:55:10.251337", "msg": "non-zero return code", "rc": 1, "start": "2024-08-26 23:55:09.184022", "stderr": "Found preexisting AWS CLI installation: /usr/local/aws-cli/v2/current. Please rerun install script with --update flag.", "stderr_lines": ["Found preexisting AWS CLI installation: /usr/local/aws-cli/v2/current. Please rerun install script with --update flag."], "stdout": "", "stdout_lines": []} ``` I propose to install the aws cli with the --upgrade option in order to overcome these situations --- images/capi/ansible/roles/providers/tasks/awscliv2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/capi/ansible/roles/providers/tasks/awscliv2.yml b/images/capi/ansible/roles/providers/tasks/awscliv2.yml index 4a301ba053..8ef42ce2a7 100644 --- a/images/capi/ansible/roles/providers/tasks/awscliv2.yml +++ b/images/capi/ansible/roles/providers/tasks/awscliv2.yml @@ -91,7 +91,7 @@ when: ansible_os_family != "Flatcar" - name: Install AWS CLI v2 - ansible.builtin.command: /tmp/aws/install -i /usr/local/aws-cli -b /usr/local/sbin + ansible.builtin.command: /tmp/aws/install --update -i /usr/local/aws-cli -b /usr/local/sbin when: ansible_os_family != "Flatcar" - name: Remove temporary files