ansible Daily Summary

A, ansible optimization

/etc/ansible/ansible.cfg Vim 

host_key_checking # = False not validated 
log_path = /var/log/ansible.log # open log 

Based ssh

vim /etc/ssh/sshd_config

UseDNS no
#重启sshd 
# systemctl restart sshd

Second, the common module

1, coyp module

ansible date -m copy -a 'src=/etc/selinux/config dest=/etc/selinux/confi

2, fetch fetch files from the client module 

ansible date -m fetch -a "src=/var/log/cron dest=/data/"

3, shell module (Run, or remote script execution), and so instead of file module

ansible date -m shell -a 'cat /etc/selinux/config'

4, script module (not need to have remote script, the control terminal can have)

ansible date -m script -a "/root/scripts/test.sh"

[root@linux-node1 scripts]# cat /root/scripts/test.sh
#!/bin/bash
hostname

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/zhaojingyu/p/12114788.html