- name: Verify repository names when: | docker_credentials.repository is defined and not item.repository | regex_search(docker_credentials.repository) loop: "{{ docker_images }}" fail: msg: "{{ item.repository }} not permitted by {{ docker_credentials.repository }}" # This is used by the delete tasks - name: Get dockerhub JWT token no_log: true uri: url: "https://hub.docker.com/v2/users/login/" body_format: json body: username: "{{ docker_credentials.username }}" password: "{{ docker_credentials.password }}" register: jwt_token delay: 5 retries: 3 until: jwt_token and jwt_token.status==200 - name: Promote image loop: "{{ docker_images }}" loop_control: loop_var: image include_tasks: promote-retag.yaml - name: Delete obsolete tags loop: "{{ docker_images }}" loop_control: loop_var: image include_tasks: promote-cleanup.yaml