以下のように書く
-e ‘ansible_python_interpreter=/usr/local/bin/python’
インベントリファイルにip, username, passを書くと、
# ansible all -i hosts -m ping -e 'ansible_python_interpreter=/usr/local/bin/python' xx.xxx.xxx.xxx | SUCCESS => { "changed": false, "ping": "pong" } xx.xxx.xxx.xxx | SUCCESS => { "changed": false, "ping": "pong" }
うおおおおおおおおおおおおおおおおおおおおおおおおおおお
まじかーーーーーーーーーーーーーーーーー
ansible.cfg
[defaults] hostfile = ./hosts
# ansible all -m ping -e ‘ansible_python_interpreter=/usr/local/bin/python’
[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it
can also be a list of hosts, a directory or a list of paths , use [defaults]
inventory=/path/to/file|dir instead. This feature will be removed in version
2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False
in ansible.cfg.
xx.xxx.xxx.xxx | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
xx.xxx.xxx.xxx | SUCCESS => {
“changed”: false,
“ping”: “pong”
}