http://www.ansible.com.cn/ 瞟了一眼手册号难受心疼我的脑袋啊
先找捷径用上在慢慢熟悉吧 不然手册看完的时候阿里都把苹果收购了
简单了解了下ansible 只要写一点shell脚本通信其他服务器 或者吧 ansible服务器上的文件 cp到 其他服务器上
在host里配置 ansible映射 在另外一个地方配置组
然后/usr/bin/ansible interactive -m copy -a "src=路径 dest=路径 mode=0777 owner=www group=root"
文件不要太多太大不然容易出问题
mac安装ansible
有brew 的 直接brew install
ansible
安装中
➜ nginx brew install ansible
Updating Homebrew...
==> Installing dependencies for ansible: sqlite, openssl, python, libyaml, openssl@1.1
==> Installing ansible dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.21.0.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring sqlite-3.21.0.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include
==> Summary
ansible all -m ping -u root
192.168.103.255 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.103.255 port 22: Operation timed out\r\n",
"unreachable": true
}
这个错误是因为ip不对
➜ ansible ansible -m ping all
192.168.103.246 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,password,keyboard-interactive).\r\n",
"unreachable": true
}
这个错误是因为ssk配置的不对 有空继续搞起 先这样吧