How copy files in ansible? Easy!
ansible + host(s) + -m copy -a "source dest on servers and permissions"
on ansible server is /etc/ansible/resolv.conf - in this server is nameserver 8.8.8.8
there is command to send
[root@localhost ~]# ansible 10.0.2.5,10.0.2.6 -m copy -a "src=/etc/ansible/resolv.conf dest=/etc/resolv.conf mode=644 owner=root group=root"
10.0.2.5 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"checksum": "e19182dd3a1465bda3aa2e1a63067bec82dd5ad3",
"dest": "/etc/resolv.conf",
"gid": 0,
"group": "root",
"mode": "0644",
"owner": "root",
"path": "/etc/resolv.conf",
"secontext": "system_u:object_r:net_conf_t:s0",
"size": 19,
"state": "file",
"uid": 0
}
10.0.2.6 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"checksum": "e19182dd3a1465bda3aa2e1a63067bec82dd5ad3",
"dest": "/etc/resolv.conf",
"gid": 0,
"group": "root",
"md5sum": "fe0b86955e4eb444f17f54d086580b1f",
"mode": "0644",
"owner": "root",
"secontext": "system_u:object_r:net_conf_t:s0",
"size": 19,
"src": "/root/.ansible/tmp/ansible-tmp-1643144657.809647-201108-123041954281265/source",
"state": "file",
"uid": 0
Žiadne komentáre:
Zverejnenie komentára