Marek
Marek

Reputation: 63

How an Ansible playbook can create zip file on remote server , even though that remote server does not have zip binary?

Believe the title says it all - I am learning Ansible, and if I run a playbook that contains :

- name: archive  is created
  archive:
    path:
    - /tmp/hello.txt
    - /tmp/hi.txt
    dest: /tmp/hh.zip
    format: zip

The zip file is created on remote/target server as per playbook, but... that remote server does not have the zip library:

ubuntu@markws:~$ zip --help
Command 'zip' not found, but can be installed with:
sudo apt install zip

My question is then, how is it possible that this playbook creates the archive on the remote server, when there is no such utility installed?

Upvotes: 0

Views: 620

Answers (1)

Zeitounator
Zeitounator

Reputation: 44645

You can read the Ansible community.general.archive module source code where you will find out that it is not using the command line zip utility but the Python zipfile builtin module

Upvotes: 3

Related Questions