I am trying to download and extract a tar archive in the remote machine and remote destination must be created if not exists. BUT it is not happening.
ERROR: destination directory doesn't exist
MYCODE:
- unarchive:
src: http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v8.5.15/bin/apache-tomcat-8.5.15.tar.gz
dest: /opt/tomcat/
creates: yes
remote_src: True
NOTE: * running the play as root.
thanks in advance
The unarchive module unpacks an archive. It will not unpack a compressed file that does not contain an archive. By default, it will copy the source file from the local system to the target before unpacking. Set remote_src=yes to unpack an archive which already exists on the target.
win_unzip module – Unzips compressed files and archives on the Windows node — Ansible Documentation.
While using the unarchive module, the dest path should be a path to an existing directory, and creates should be a path to a file and not a boolean.
- name: ensure tomcat directory exists
file:
path: /opt/tomcat
state: directory
- unarchive:
src: http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v8.5.15/bin/apache-tomcat-8.5.15.tar.gz
dest: /opt/tomcat/ # already existing path
creates: /opt/tomcat/config # some path to make sure that the archive has already been unpacked
remote_src: yes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With