Created
June 11, 2017 18:48
-
-
Save benileo/a01126a908b654e6b25d935ab1c11ced to your computer and use it in GitHub Desktop.
Ansible, cloud init has completed successfully
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
- name: Ensuring that cloud init has complete. | |
hosts: "Enter your hosts here" | |
tasks: | |
- stat: | |
path: /var/lib/cloud/instance/boot-finished | |
register: st | |
- fail: | |
msg: "/var/lib/cloud/instance/boot-finished does not exist; Cloud init has not complete" | |
when: st.stat.exists == False | |
- shell: | |
cmd: > | |
cat /var/lib/cloud/data/result.json | python -c "import sys,json; sys.exit(1) if json.loads(sys.stdin.read())['v1']['errors'] else sys.exit(0)" | |
become: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment