Hi Experts,
I have below play book for extracting a .zip file from Ansible controller
machine to the target folders. But i noticed that play is not working as
expected if the target folder and the unzipped files are already present in
the target servers. Could you please guide me here ?
############################################################
---
- name: Extract mypack.zip into /opt/mypack
hosts: localhost
vars:
source_dir: /etc/ansible/roles/IBM2/files/mypack.zip
dest_dir: /opt/mypack
tasks:
- name: check the folder existance
stat: path=/opt/mypack
register: folder_exist
- name: create directory
command: mkdir /opt/mypack
when: folder_exist.stat.exists == False
- name: extract the .zip file
unarchive:
src: "{{ source_dir }}"
dest: "{{ dest_dir }}/"
creates: no
when: folder_exist.stat.exists == True
#####################################################################
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/09e072d7-a3f6-485a-8e9b-fb8d8497228b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.