major cleanup of ansible tasks in podman role

This commit is contained in:
Bastian de Byl
2023-07-24 13:38:34 -04:00
parent 71e9f4590b
commit 4c40a42707
18 changed files with 227 additions and 249 deletions

View File

@@ -0,0 +1,21 @@
---
- name: fetch aws ecr auth token
become: true
become_user: "{{ podman_user }}"
shell: |
aws ecr get-authorization-token --region us-east-1
register: ecr_command
- set_fact:
ecr_authorization_data: "{{ (ecr_command.stdout | from_json).authorizationData[0] }}"
- set_fact:
ecr_credentials: "{{ (ecr_authorization_data.authorizationToken | b64decode).split(':') }}"
- name: podman login to AWS ECR
become: true
become_user: "{{ podman_user }}"
containers.podman.podman_login:
registry: "{{ aws_ecr_endpoint }}"
username: "{{ ecr_credentials[0] }}"
password: "{{ ecr_credentials[1] }}"