ismvilla.blogg.se

Ansible playbook to install tomcat on centos 7
Ansible playbook to install tomcat on centos 7








ansible playbook to install tomcat on centos 7 ansible playbook to install tomcat on centos 7
  1. ANSIBLE PLAYBOOK TO INSTALL TOMCAT ON CENTOS 7 UPDATE
  2. ANSIBLE PLAYBOOK TO INSTALL TOMCAT ON CENTOS 7 CODE
  3. ANSIBLE PLAYBOOK TO INSTALL TOMCAT ON CENTOS 7 DOWNLOAD

Connect to the tomcat web interface and validate - we are using the uri module to connect to the to ensure that the tomcat is started and running fine.Ansible package is not available in the default yum repositories, so we will enable epel repository for CentOS 7 using below commands ~]# yum install epel-release -y Step:2 Install Anisble using yum command ~]# yum install ansible.Enabling the tomcat to Auto-Start - We are enabling the tomcat service we just created, for the boot time auto-start.Ansible has a dedicated module named systemd for to interact with SystemDaemon Reloading SystemD - Once the service file is created and placed on the appropriate /etc/systemd directory, we need to reload the system daemon to sync the changes.we are using |- to maintain the line break while assigning the multiline data to the content variable. another way to do it is to use template but this is convenient. Creating a Service file for tomcat - we are using the copy module to create a file in remote and the content of the service file is hard coded inside the playbook itself.we are basically moving the content from apache-tomcat-**** to /opt/tomcat8 for simplicity using shell module, you can use copy module too it would leave us with a big directory with a clumsy name containing the version etc. Moving files to the right directory - Once the untar is done.

ansible playbook to install tomcat on centos 7

we have combined the efforts of get_url and unarchive together as unarchive can have URL as a source

ANSIBLE PLAYBOOK TO INSTALL TOMCAT ON CENTOS 7 DOWNLOAD

  • Download Tomcat installable tar - the unarchive module is used to download tomcat from the URL and to untar once the file is downloaded.
  • Directory creation - the file module is used to create a directory where the tomcat server be installed and operated.
  • Create a User - we are creating a new user named tomcat using user module, this user and the group would be used by the tomcat application server as its not recommended to run servers on Root.
  • Create a Group - we are using a group module is used to create linux user group named tomcat.
  • Validate if Java is available - shell module is used to run a java -version command, the playbook would fail if the command fails (or) not found.
  • Download Open JDK - we are using the apt module to install java as a system package.
  • Let us see each play and its purpose along with what module is used. this playbook consists of the following steps or tasks, In Ansible's dictionary, they are called as plays. In this playbook, we have used a lot of Ansible modules to facilitate various tasks. Now you can sit back and relax while Ansible does everything for you. Once you have updated, you are good to go and execute the playbook with the following command ansible-playbook install-tomcat.yaml Just right-click on that hyperlink and click on copy link that's all. In the preceding snapshot, I have highlighted where I have taken the download URL from.

    ANSIBLE PLAYBOOK TO INSTALL TOMCAT ON CENTOS 7 UPDATE

    So make sure you update the Download URL by visiting the Apache tomcat download page I have taken the URL from the tomcat website but it changes often and per region of the world. Let me know if you need any help or face any issues. You can replace it with yum if you are using this playbook for other linux distributions. This ansible-playbook is designed specifically for ubuntu or debian architecture Linux Systems.Īs we are using apt package manager command to install java. name: Connect to Tomcat server on port 8080 and check status 200 - Try 5 times name: Enable the tomcat service and start name: Reload the SystemD to re-read configurations Shell: "mv /opt/tomcat8/apache*/* /opt/tomcat8"Įnvironment="CATALINA_PID=/opt/tomcat8/logs/tomcat.pid"Įnvironment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC" name: Move files to the /opt/tomcat8 directory We will decode this Ansible playbook and cover each task in detail shortly.

    ANSIBLE PLAYBOOK TO INSTALL TOMCAT ON CENTOS 7 CODE

    Here is the source code of the Ansible playbook.

  • Ansible playbook to install Java and TomcatĪnsible playbook to install Java and Tomcat.









  • Ansible playbook to install tomcat on centos 7