6/13/2023 0 Comments Untar tar.gz![]() 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.
0 Comments
Leave a Reply. |