beatvova.blogg.se

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 install#
  2. Ansible playbook to install tomcat on centos 7 update#
  3. Ansible playbook to install tomcat on centos 7 code#
  4. Ansible playbook to install tomcat on centos 7 download#

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.
  • 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.
  • Ansible playbook to install tomcat on centos 7 install#

  • 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.

    ansible playbook to install tomcat on centos 7

    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 -m command -a "grep mark /etc/passwd" 'test-servers'Įxample:4 Redirecting the output of command to a file ~]# ansible -m command -a "df -Th" 'test-servers' > /tmp/command-output. Step:5 Now try to run the Commands from Ansible Server.Ĭheck the connectivity of ‘test-servers’ or ansible nodes using ping ~]# ansible -m ping 'test-servers'Įxample :1 Check the uptime of Ansible nodes ~]# ansible -m command -a "uptime" 'test-servers'Įxample:2 Check Kernel Version of nodes ~]# ansible -m command -a "uname -r" 'test-servers'Įxample:3 Adding a user to the nodes ~]# ansible -m command -a "useradd mark" 'test-servers' Step:4 Define the nodes or inventory of servers for Ansible.įile ‘ /etc/ansible/hosts‘ maintains the inventory of servers for Ansible. Use ssh-copy-id command to copy public key of Ansible server to its nodes. Generate keys on the Ansible server and copy public key to the nodes.

    ansible playbook to install tomcat on centos 7

    Step:3 Setup keys based SSH authentication with Nodes. Once the installation is completed, check the ansible version : ~]# ansible -version 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







    Ansible playbook to install tomcat on centos 7