ansible日常小结
一、ansible优化
vim /etc/ansible/ansible.cfg host_key_checking = False #不进行验证 log_path = /var/log/ansible.log #打开日志
基于ssh
vim /etc/ssh/sshd_config UseDNS no #重启sshd # systemctl restart sshd
二、常用模块
1、coyp 模块
ansible date -m copy -a ‘src=/etc/selinux/config dest=/etc/selinux/confi
2、fetch模块 从客户端取文件
ansible date -m fetch -a "src=/var/log/cron dest=/data/"
3、shell模块(执行命令、或者执行远程脚本)、也这样代替file模块
ansible date -m shell -a ‘cat /etc/selinux/config‘
4、script模块(远程不需要有脚本,控制端有可以)
ansible date -m script -a "/root/scripts/test.sh" [ scripts]# cat /root/scripts/test.sh #!/bin/bash hostname
相关推荐
laisean 2020-09-27
onepiecedn 2020-10-29
guchengxinfen 2020-10-12
houdaiye 2020-09-23
逆时针 2020-08-19
pzczyy 2020-08-19
annan 2020-08-02
hpujsj 2020-07-26
annan 2020-07-18
逆时针 2020-06-21
annan 2020-06-20
逆时针 2020-06-14
逆时针 2020-06-14
awoyaoc 2020-06-12
逆时针 2020-06-09
piaotiejun 2020-06-07
awoyaoc 2020-06-07