tar.gz file to the destination remote host /tmp/phyes. name: Extract the archive file on the remote node name: Ansible playbook to unarchive the files on the remote nodes. Here are the following examples mention below Example #1 – unarchive module task for UNIX os. name: unarchive for from the remote source on the non-windows target You must have noticed here, although the source path is remote, we don’t need to use remote_src because the win_unzip module doesn’t support it and when we use the remote source path for the non-target windows server we must specify the remote_src. ![]() If the destination path doesn’t exist it creates the destination path. The above playbook will unzip the file from the source location to the destination remote servers. name: Unzip the file from the remote location name: Ansible playbook for windows unzip module If the module is not available then you can download it from the galaxy.Īnsible-galaxy collection install community.windowsīelow is the simple playbook for windows untar (unzip). For the windows target, we need to use the win_unzip module. How untar works in Ansible?Īnsible unarchive module for non-windows target comes with the ansible-base and so it is included in the Ansible installations. ![]() Please note: the win_unzip module doesn’t use the remote_src parameter. Setting value ‘yes’ requires the PSCX module to be installed.recursively expands the zip file within the src directory.If the Zip file is password encrypted then this parameter is useful and it requires the PSCX module to be installed.There are other additional parameters like creates, seuser, serole, setype, selevel, unsafe_writes, validate_certs.įor the windows target src, dest, creates parameters remain the same as unarchive module and the additional parameters are as below. Permissions that the files or directories should have after unpacked (like 644, 777, etc).If set yes, it replaces the existing files that are newer than the files inside the archive.List of files or directories that need to be included in the unpacking process.List of files or directories that need to be excluded from the unpacking.Name of the group that should own the files/directory and same replicates (added) to the chown.name of the user that should own the files/directory after unpack and same replicates (added) to the chown.For the ‘no’ value the path is on the local controller node. If set ‘yes’ specifies that the source archive path is on the remote computer.Remote server absolute path where the archive is going to extract.If remote_src is ‘yes’ then the source path would be on the remote location otherwise the source path is on the local controller node. For working with the remote source need to specify the remote_src and this copy parameter is not helpful there. The default Option is Yes and it copies the files from the local controller to the remote host if specified yes or nothing specified.
0 Comments
Leave a Reply. |