安装Ansible
brew install ansible
创建自己的playbooks
cd /Users/wangzhen/works/oneDriver/OneDrive/Developer
mkdir playbooks
## 创建hosts
在playbooks目录下创建一个名叫hosts的文件,这个文件将作为inventory文件。在hosts文件中写入下面内容:
testserver ansible_ssh_host=192.168.3.175 ansible_ssh_port=22 ansible_ssh_user=root
验证ansible连接testserver
让我们告诉Ansible连接到名为testserver的服务器(在inventory的hosts文件中描述并引入ping模块)
LS-MacBook-Pro:playbooks wangzhen$ ansible testserver -i hosts -m ping
The authenticity of host '192.168.3.175 (192.168.3.175)' can't be established.
RSA key fingerprint is SHA256:gzfyP+1OOYtxE+/fwFxzk+QiWe/28zSigo96sepjmGM.
Are you sure you want to continue connecting (yes/no)? yes
testserver