diff --git a/roles/deploy_container/tasks/main.yml b/roles/deploy_container/tasks/main.yml index 4eb9d87a..37013df2 100644 --- a/roles/deploy_container/tasks/main.yml +++ b/roles/deploy_container/tasks/main.yml @@ -10,23 +10,27 @@ ansible.builtin.set_fact: _docker_registry_username: "{{ deploy_container.docker_registry_user }}" _docker_registry_password: "{{ deploy_container.docker_registry_pass }}" + delegate_to: localhost # Token valid for 12 hours - name: Fetch AWS ECR registry login token. ansible.builtin.command: - command: "aws ecr get-login-password --region {{ deploy_container.aws_ecr.region }} --profile {{ deploy_container.aws_ecr.profile }}" + cmd: "aws ecr get-login-password --region {{ deploy_container.aws_ecr.region }} --profile {{ deploy_container.aws_ecr.profile }}" when: deploy_container.aws_ecr.enabled + delegate_to: localhost register: _docker_registry_ecr_token - name: Set AWS ECR registry password. ansible.builtin.set_fact: _docker_registry_password: "{{ _docker_registry_ecr_token.stdout }}" when: deploy_container.aws_ecr.enabled + delegate_to: localhost - name: Set AWS ECR registry username. ansible.builtin.set_fact: _docker_registry_username: "AWS" when: deploy_container.aws_ecr.enabled + delegate_to: localhost - name: Log into Docker registry. community.docker.docker_login: @@ -35,7 +39,6 @@ password: "{{ _docker_registry_password }}" reauthorize: true delegate_to: localhost - when: deploy_container.docker_registry_login - name: Build and push container image. community.docker.docker_image: