ansible通过 SSH 协议远程管理计算机组。使用
/etc/ansible/hosts文件来添加组 / 主机。 此命令也有关于其子命令的文件,例如:galaxy. 更多信息:https://docs.ansible.com/ansible/latest/cli/ansible.html.
ansible {{组}} --list-hosts
ansible {{组}} {{[-m|--module-name]}} ping
ansible {{组}} {{[-m|--module-name]}} setup
ansible {{组}} {{[-m|--module-name]}} command {{[-a|--args]}} '{{命令}}'
ansible {{组}} {{[-b|--become]}} --ask-become-pass {{[-m|--module-name]}} command {{[-a|--args]}} '{{命令}}'
ansible {{组}} {{[-i|--inventory]}} {{清单文件}} {{[-m|--module-name]}} command {{[-a|--args]}} '{{命令}}'
ansible localhost {{[-m|--module-name]}} debug {{[-a|--args]}} '{{var=groups.keys()}}'