Skip to content

Instantly share code, notes, and snippets.

@genzj
Created February 17, 2019 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genzj/eaa8dfd1b26b3dea298785cf2db99e43 to your computer and use it in GitHub Desktop.
Save genzj/eaa8dfd1b26b3dea298785cf2db99e43 to your computer and use it in GitHub Desktop.
An example of an ansible dynamic inventory script in Python
{
"group001": {
"hosts": ["host001", "host002"],
"vars": {
"var1": true
},
"children": ["group002"]
},
"group002": {
"hosts": ["host003","host004"],
"vars": {
"var2": 500
},
"children":[]
},
"server": {
"hosts": ["ansible-target.local"],
"vars": {
"ansible_ssh_private_key_file": "~/ansible-exercise-key",
"ansible_user": "ansible"
},
"children":[]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment