

– name: Recursively change ownership of a directory Shell: cd /tmp/jenkin/in28minutes-web-servlet-jsp/target cp in28minutes.war /opt/apache-tomcat-8.5.50/webapps/ Shell: cd /tmp /usr/bin/git clone cd /tmp/jenkin mvn clean installĬommand: chdir=/usr/share /bin/tar xvf /opt/apache-tomcat-8.5.50.tar.gz -C /opt/ war playbooks]# vim deploysjavacode.ymlĬommand: chdir=/usr/share /bin/tar xvf /opt/apache-maven-3.6. -C /opt/

– name: Unarchive a file that is already on the remote machine Playbook to install playbooks]# vim installjava.yml So i had to do it manually and it is working fine. Issue – tomcat is not getting started on slave node. Operating System: Hat Enterprise Linux 8.0 (Ootpa) I have configured my Ansible control and slave node on Amazon EC2 Remote_webapps: /usr/share/tomcat/webapps/Ĭommand: cp Remote_warfile: /root/workspace/myproject/target/myproject.war You can also set variable with arguments vars. tasks:įile: path=/usr/share/tomcat/webapps/myproject state=absentĬopy the war file to the tomcat webapps folder. name: delete war file in tomcat webappsįile: path=/usr/share/tomcat/webapps/myproject.war state=absentĭuring deployment, deleted the old web project files in recursively. tasks:ĭuring deployment, deleted the old war file. When everything is deployed, we need to start the tomcat. Create task stop tomcatĪt first, we need to stop the tomcat. While if directly execute playbook will causing terminal stuck to wait for user input credential without acknowlegement. The most tricky part for me is the git pull request, because it required to enter username and password.
ANSIBLE INSTALL JAVA ON MAC CODE
The following is piece of code for each task describe what you need to accomplish the task given. (ansible_env) MacBook-Air:playbook2 mingch$ ansible all -i inventory -m If everything run fine, you should have similar result. If you encounter failure add -vvvv arguments for error details. Our first goal is to ping each server so that we can continue develop the task to fulfill the above requirement. like hostfile value inventory is pointing to the inventory file we’ve just created.

This ansible.cfg file has few default argument.

