Skip to content

Instantly share code, notes, and snippets.

@markuman
Created February 12, 2019 16:07
Show Gist options
  • Save markuman/5eec86eefeb5d7503c07b94321108cc4 to your computer and use it in GitHub Desktop.
Save markuman/5eec86eefeb5d7503c07b94321108cc4 to your computer and use it in GitHub Desktop.
m@pop-os:~/git/myinv$ python3 myinv.py --list
{"awslnx": {"hosts": ["10.115.4.119"], "vars": {"ansible_ssh_user": "ec2-user", "ansible_ssh_private_key_file": "~/.ssh/id_ed25519"}}}
m@pop-os:~/git/myinv$ python3 myinv.py --list |jq '.'
{
"awslnx": {
"hosts": [
"10.115.4.119"
],
"vars": {
"ansible_ssh_user": "ec2-user",
"ansible_ssh_private_key_file": "~/.ssh/id_ed25519"
}
}
}
m@pop-os:~/git/myinv$ ansible -i myinv.py awslnx -m ping
[WARNING]: * Failed to parse /home/m/git/myinv/myinv.py with script plugin: Invalid data from file, expected dictionary and got: None
[WARNING]: * Failed to parse /home/m/git/myinv/myinv.py with ini plugin: /home/m/git/myinv/myinv.py:4: Expected key=value host variable assignment, got: json
[WARNING]: Unable to parse /home/m/git/myinv/myinv.py as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
10.115.4.119 | SUCCESS => {
"changed": false,
"ping": "pong"
}
m@pop-os:~/git/myinv$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment