更新时间:2023-02-26 22:06:15
目前,ansible中没有模块可以在Windows上进行zip归档.我已经创建了一个简单的模块,其作用类似于我使用的win-unzip,只要在主机上安装了Powershell 4,该模块就可以为您工作.代码在这里: https://github.com/tjkellie/PublicRepo/blob/master/ansible 在创建正式模块之前可以随时使用.
There is no module from ansible currently to do zip archiving on Windows. I've created a simple module that acts like win-unzip that I use, as long as powershell 4 is installed on the host this should work for you. The code is here: https://github.com/tjkellie/PublicRepo/blob/master/ansible feel free to use until an official module is created.
将文件添加到您的媒体库中:
Add the files to your library:
library/ # Put the custom modules files here
filter_plugins/
roles/
library/ # or here
并使用像这样的剧本中的模块:
And use the module from a playbook like this:
- name: zip a directory
win_zip:
src: C:\Users\Someuser\Logs
dest: C:\Users\Someuser\OldLogs.zip
creates: C:\Users\Someuser\OldLogs.zip