第一个ansible例子
主机信息
步骤
192.168.2.105 ansible_port=22 ansible_user=root ansible_ssh_pass=root$ ansible 192.168.2.105 -m shell -a "echo 'hello world' > /root/hello.txt"
192.168.2.105 | CHANGED | rc=0 >>多台主机批量执行
Last updated
192.168.2.105 ansible_port=22 ansible_user=root ansible_ssh_pass=root$ ansible 192.168.2.105 -m shell -a "echo 'hello world' > /root/hello.txt"
192.168.2.105 | CHANGED | rc=0 >>Last updated
192.168.2.105 ansible_port=22 ansible_user=root ansible_ssh_pass=root
192.168.2.106 ansible_port=22 ansible_user=root ansible_ssh_pass=root
[all]
192.168.2.105
192.168.2.106$ ansible all -m shell -a "echo 'hello world' > /root/hello.txt"