From 8e619b2e8d1898a3f98c5b8d4701faaef98f3b99 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Thu, 23 May 2024 15:38:12 +0100 Subject: [PATCH] Fix aws cli installation on Flatcar Signed-off-by: Marcus Noble --- images/capi/.ansible-lint-ignore | 1 + .../roles/providers/tasks/awscliv2.yml | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/images/capi/.ansible-lint-ignore b/images/capi/.ansible-lint-ignore index e5cdcb5379..dc513ba1c2 100644 --- a/images/capi/.ansible-lint-ignore +++ b/images/capi/.ansible-lint-ignore @@ -45,6 +45,7 @@ ansible/roles/providers/tasks/aws.yml command-instead-of-shell ansible/roles/providers/tasks/aws.yml name[missing] ansible/roles/providers/tasks/aws.yml no-changed-when ansible/roles/providers/tasks/awscliv2.yml no-changed-when +ansible/roles/providers/tasks/awscliv2.yml package-latest ansible/roles/providers/tasks/awscliv2.yml risky-file-permissions ansible/roles/providers/tasks/azure.yml name[missing] ansible/roles/providers/tasks/azure.yml risky-file-permissions diff --git a/images/capi/ansible/roles/providers/tasks/awscliv2.yml b/images/capi/ansible/roles/providers/tasks/awscliv2.yml index bb5a88820a..4a301ba053 100644 --- a/images/capi/ansible/roles/providers/tasks/awscliv2.yml +++ b/images/capi/ansible/roles/providers/tasks/awscliv2.yml @@ -1,4 +1,20 @@ --- +- name: Upgrade pip to latest + ansible.builtin.pip: + name: pip + executable: pip3 + state: latest + when: ansible_os_family == "Flatcar" + +- name: Install aws clients via pip + ansible.builtin.pip: + name: "{{ packages }}" + executable: pip3 + vars: + packages: + - awscli + when: ansible_os_family == "Flatcar" + - name: Install AWS CLI prequisites ansible.builtin.yum: name: @@ -49,30 +65,37 @@ EOF gpg --import aws-public-key rm aws-public-key + when: ansible_os_family != "Flatcar" - name: Download AWS CLI v2 archive signature file ansible.builtin.get_url: url: https://awscli.amazonaws.com/awscli-exe-linux-{{ ansible_architecture }}.zip.sig dest: /tmp/awscliv2.zip.sig + when: ansible_os_family != "Flatcar" - name: Download AWS CLI v2 archive ansible.builtin.get_url: url: https://awscli.amazonaws.com/awscli-exe-linux-{{ ansible_architecture }}.zip dest: /tmp/awscliv2.zip + when: ansible_os_family != "Flatcar" - name: Verify AWS CLI v2 archive ansible.builtin.command: gpg --verify /tmp/awscliv2.zip.sig /tmp/awscliv2.zip + when: ansible_os_family != "Flatcar" - name: Unzip AWS CLI v2 archive ansible.builtin.unarchive: src: /tmp/awscliv2.zip dest: /tmp remote_src: true + 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 + when: ansible_os_family != "Flatcar" - name: Remove temporary files ansible.builtin.file: path: /tmp/aws* state: absent + when: ansible_os_family != "Flatcar"