Skip to content

Commit

Permalink
Merge pull request #1472 from giantswarm/fix_flatcar_awscli
Browse files Browse the repository at this point in the history
Fix aws cli installation on Flatcar
  • Loading branch information
k8s-ci-robot authored May 23, 2024
2 parents 8ea279e + 8e619b2 commit d62ea28
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions images/capi/.ansible-lint-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions images/capi/ansible/roles/providers/tasks/awscliv2.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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"

0 comments on commit d62ea28

Please sign in to comment.