ansible模块--archive模块
原创
©著作权归作者所有:来自51CTO博客作者wx62e28ac222a20的原创作品,请联系作者获取转载授权,否则将追究法律责任
path:源路径,准备打包的文件
dest:打成什么格式的包,放到什么位置
mode:权限
[root@ansible tmp]# ansible mysql -m archive -a 'path=/var/log/*.log dest=/tmp/logs.tar.gz'
192.168.56.88 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"archived": [
"/var/log/boot.log",
"/var/log/yum.log"
],
"arcroot": "/var/log/",
"changed": true,
"dest": "/tmp/logs.tar.gz",
"expanded_exclude_paths": [],
"expanded_paths": [
"/var/log/boot.log",
"/var/log/yum.log"
],
"gid": 0,
"group": "root",
"missing": [],
"mode": "0644",
"owner": "root",
"size": 149,
"state": "file",
"uid": 0
}
带权限打包
[root@ansible tmp]# ansible mysql -m archive -a 'path=/var/log/*.log dest=/tmp/logs.tar.gz mode=777'
192.168.56.88 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"archived": [
"/var/log/boot.log",
"/var/log/yum.log"
],
"arcroot": "/var/log/",
"changed": true,
"dest": "/tmp/logs.tar.gz",
"expanded_exclude_paths": [],
"expanded_paths": [
"/var/log/boot.log",
"/var/log/yum.log"
],
"gid": 0,
"group": "root",
"missing": [],
"mode": "0777",
"owner": "root",
"size": 149,
"state": "file",
"uid": 0
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
ansible