ansible

2019-01-04  本文已影响0人  HaoDongZ
[test@l-t.ops.prod.aws.dm ~]$ cat ip.txt  配置免密码登录 并且推送文件到远程主机
[ip]
10.24.61.16
10.24.61.29
[ip:vars]
ansible_ssh_user=
ansible_ssh_pass=
ansible_sudo_user=
ansible_sudo_pass=
ansible_ssh_port=22

ansible  -i ip.txt  ip -m copy -a  "src=/home/ansible/ansible-sh.sh  dest=/root"  推送文件

ansible -i  ip.txt   ip   -m shell  -a   "echo "spBxxx1212" | passwd --stdin root"   批量修改密码


-m script  
 ansible  -i /etc/ansible/jhn.txt  jhn  -m shell   -a 'echo  " nohup  /usr/bin/node_exporter & >/dev/null" >> /etc/rc.local'

ansible  -i /etc/ansible/fwzx.txt  fwzx   -m authorized_key -a "user=root key='{{ lookup('file', '/root/.ssh/id_rsa.pub')}}' path='/root/.ssh/authorized_keys' manage_dir=no" --ask-pass -c paramiko        批量推送key


ansible  -i /etc/ansible/tyb.txt  tyb  -m  copy  -a "src=node_exporter  dest=/usr/bin/ mode=777" 推送文件授权777
上一篇 下一篇

猜你喜欢

热点阅读