- 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 }}" - name: Log in to dockerhub command: "docker login -u {{ docker_credentials.username }} -p {{ docker_credentials.password }}" no_log: true - name: Upload image to dockerhub loop: "{{ docker_images }}" loop_control: loop_var: image include_tasks: push.yaml