Unarchive: src: "" dest: "/opt/tomcat8/" mode: 0755 remote_src: yes register: "tcinstall" - name: Start the tomcat instanceīecome: yes shell: "./startup.sh" args: chdir: "/opt/tomcat8/apache-tomcat-8.5.49/bin" Mode: 0755 - name : Download and install tomcat 0-openjdk-develīecome: yes file: path: "/opt/tomcat8" state: directory The Playbook - name: Playbook to download and install tomcat8īecome: yes yum: name: java -1.8. Un-tar or uncompress the tomcat into the directory created.Download the tar.gz file of Tomcat8 binaries.Here is a quick example playbook which performs the following tasks This is an exciting and wonderful feature of Ansible unarchive module, as it can take URLs as a source of zip file and download it and uncompress it. Now let us see the other features of Ansible unarchive module.ĭownload a Zip file from remote URL and decompress using unarchive Now we know how this unarchive module is working and this playbook has set some context. In a Simple playbook like this we may not measure the value of reducing a task but when it comes to big roles reducing a Number of tasks means something. Vars: - userid : "weblogic" - oracle_home: "/opt/oracle" - jdk_instl_file: "server-jre-8u191-linux-圆4.tar.gz" tasks: - name : Copy the Java JDK filesīecome: yes become_user: " " name: Playbook to copy file and uncompress In this playbook, we use the usual copy module to copy the files over to the remote server and uncompress it using the tar -xvf command Playbook without Unarchive - A usual approach The Example playbooks with and without unarchive module are given below. In the preceding Snapshot, you can see how the playbook with two tasks became a Single task with help of unarchive. Unarchive could do it as a Single task as it can optionally copy the file from control machine to target remote server and uncompress it there. Let us suppose that you have a playbook with two tasks as follows refer the below postĪnsible Archive Examples - Zip files and Directories If you would like to know how to create archive with ansible. So I guess this gives you a clear understanding of how Ansible unarchive module does the job in the background.īefore going to ansible unarchive. If this arg is not supported, it will always unpack the archive. It Uses gtar’s -diff arg to calculate if changed or not.This module requires zipinfo and gtar/ unzip command on the target remote host.Some Quick notes before we see an example of this module Since most of the *nix distributions are having these tools built-in. So the target server must have these commands installed. this module uses the basic unzip and tar -xvf command-line tools to perform the operation. Though the unarchive module is part of Ansible. Ansible unarchive module can optionally copy the files to the remote server before uncompressing them. What is Ansible Unarchive Module and How does it workĪnsible Unarchive module helps to unpack or uncompress the files from an archive file such as tar, tar.gz, zip. What is this remote_src in ansible unarchive module.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |