Skip to content
GitHub

Ansible

ansible 是一个基于 python 实现的自动化运维工具, 实现对多个系统进行批量化操作.

安装

 $ apt install ansible

编辑 /etc/ansible/hosts 添加群组或节点

[manager]
localhost

[node]
172.17.0.10
 $ ansible
 $ ansible-doc
 $ ansible-playbook
 $ ansible-vault
 $ ansible-console

 $ ansible <host pattern> -m <module> -a <args>
 $ ansible all -m shell -a "ifconfig"
 >
 $ ansible --version
 $ ansible all --list-host
 >
 $ ansible <host pattern> -m command -a <command>
 $ ansible <host pattern> -m shell -a <shell command>
 >
 $ ansible node -m copy -a "src=/root/local dst=/root/remote"
 $ ansible node -m fetch -a "src=/root/remote dst=/root/local"
 >