相信标题说明了一切-我正在学习Ansible,如果我运行一个包含以下内容的剧本:
- name: archive is created
archive:
path:
- /tmp/hello.txt
- /tmp/hi.txt
dest: /tmp/hh.zip
format: zip
zip文件是根据剧本在远程/目标服务器上创建的,但是。。。该远程服务器不具有压缩库:
ubuntu@markws:~$ zip --help
Command 'zip' not found, but can be installed with:
sudo apt install zip
那么,我的问题是,当没有安装这样的实用程序时,这个剧本怎么可能在远程服务器上创建存档?
您可以阅读Ansiblecommunity.general.archive
模块源代码,在那里您会发现它不是使用命令行zip
实用程序,而是使用Pythonzipfile
内置模块