当前位置:   article > 正文

ansible模块--unarchive模块

ansible unarchive每次都要重新执行

copy:copy=no为源tar包从被控端解压。 copy=tes 为源tar包从主控端解压
src:源tar包路径
dest:解压到的目标位置
mode:解压后的文件权限https://www.cndba.cn/hbhe0316/article/19209https://www.cndba.cn/hbhe0316/article/19209https://www.cndba.cn/hbhe0316/article/19209

  1. [root@ansible tmp]# ansible mysql -m unarchive -a 'src=/root/logs.tar.gz dest=/tmp copy=no'
  2. 192.168.56.88 | CHANGED => {
  3. "ansible_facts": {
  4. "discovered_interpreter_python": "/usr/bin/python"
  5. },
  6. "changed": true,
  7. "dest": "/tmp",
  8. "extract_results": {
  9. "cmd": [
  10. "/usr/bin/gtar",
  11. "--extract",
  12. "-C",
  13. "/tmp",
  14. "-z",
  15. "-f",
  16. "/root/logs.tar.gz"
  17. ],
  18. "err": "",
  19. "out": "",
  20. "rc": 0
  21. },
  22. "gid": 0,
  23. "group": "root",
  24. "handler": "TgzArchive",
  25. "mode": "01777",
  26. "owner": "root",
  27. "size": 4096,
  28. "src": "/root/logs.tar.gz",
  29. "state": "directory",
  30. "uid": 0
  31. }

解压的时候加权限https://www.cndba.cn/hbhe0316/article/19209https://www.cndba.cn/hbhe0316/article/19209https://www.cndba.cn/hbhe0316/article/19209https://www.cndba.cn/hbhe0316/article/19209https://www.cndba.cn/hbhe0316/article/19209

https://www.cndba.cn/hbhe0316/article/19209
https://www.cndba.cn/hbhe0316/article/19209
  1. [root@ansible tmp]# ansible mysql -m unarchive -a 'src=/root/logs.tar.gz dest=/tmp mode=777 copy=no'
  2. 192.168.56.88 | CHANGED => {
  3. "ansible_facts": {
  4. "discovered_interpreter_python": "/usr/bin/python"
  5. },
  6. "changed": true,
  7. "dest": "/tmp",
  8. "extract_results": {
  9. "cmd": [
  10. "/usr/bin/gtar",
  11. "--extract",
  12. "-C",
  13. "/tmp",
  14. "-z",
  15. "-f",
  16. "/root/logs.tar.gz"
  17. ],
  18. "err": "",
  19. "out": "",
  20. "rc": 0
  21. },
  22. "gid": 0,
  23. "group": "root",
  24. "handler": "TgzArchive",
  25. "mode": "01777",
  26. "owner": "root",
  27. "size": 4096,
  28. "src": "/root/logs.tar.gz",
  29. "state": "directory",
  30. "uid": 0
  31. }

版权声明:本文为博主原创文章,未经博主允许不得转载。

ansible

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/837436
推荐阅读
相关标签
  

闽ICP备14008679号