ansible

[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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容