Last active
February 23, 2017 22:55
-
-
Save patrickmslatteryvt/97c8140d79f0161be53fc65b872f23c6 to your computer and use it in GitHub Desktop.
docker_login until failures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Task | |
- name: "Log into hub.docker.com" | |
become: yes | |
become_user: automation | |
docker_login: | |
username: "{{ docker_hub_username }}" | |
password: "{{ docker_hub_password }}" | |
email: "{{ docker_hub_email }}" | |
register: docker_login_result | |
# until: docker_login_result.login_result.Status == "Login Succeeded" | |
until: docker_login_result.find("Login Succeeded") != -1 | |
retries: 10 | |
delay: 15 | |
# On success | |
changed: [host.domain.com] => { | |
"attempts": 1, | |
"changed": true, | |
"invocation": { | |
"module_args": { | |
"api_version": null, | |
"cacert_path": null, | |
"cert_path": null, | |
"config_path": "~/.docker/config.json", | |
"debug": false, | |
"docker_host": null, | |
"email": "[email protected]", | |
"filter_logger": false, | |
"key_path": null, | |
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", | |
"reauthorize": false, | |
"registry_url": "https://index.docker.io/v1/", | |
"ssl_version": null, | |
"state": "present", | |
"timeout": null, | |
"tls": null, | |
"tls_hostname": null, | |
"tls_verify": null, | |
"username": "user" | |
} | |
}, | |
"login_result": { | |
"IdentityToken": "", | |
"Status": "Login Succeeded" | |
} | |
} | |
# On failure | |
fatal: [hostname.domain.com]: FAILED! => { | |
"failed": true, | |
"msg": "The conditional check 'docker_login_result.login_result.Status == \"Login Succeeded\"' failed. | |
The error was: error while evaluating conditional (docker_login_result.login_result.Status == \"Login Succeeded\"): | |
'dict object' has no attribute 'login_result'" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment