Skip to content

Ansible Role to install tomcat o Debian, Ubuntu, Fedora and CentOS Linux

License

Notifications You must be signed in to change notification settings

vanjiexpleo/tomcat-ansible

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Role info

Ansible Role to Install Tomcat 9 on CentOS, Fedora, Debian and Ubuntu Linux.

Tested on the following operating systems

  • CentOS 8
  • CentOS 7
  • Fedora 36
  • Ubuntu 20.04 / Ubuntu 18.04
  • Debian 11 / Debian 10

Tasks in the role

This role contains tasks to:

  • Install basic packages required
  • Install Java
  • Add tomcat user and group
  • Download tomcat and install - configure systemd
  • Configure firewall

How to use this role

  • Clone the Project:
$ git clone https://github.com/jmutai/tomcat-ansible.git
$ cd tomcat-ansible
  • Update your inventory, e.g:
$ vim hosts
[tomcat_nodes]
192.168.10.10       # Remote user to act on
  • Update variables in playbook file - Set Tomcat version, remote user and Tomcat UI access credentials
  • Update ansible.cfg file if necessary
$ vim tomcat-setup.yml
- name: Tomcat deployment playbook
  hosts: tomcat_nodes       # Inventory hosts group / server to act on
  become: yes               # If to escalate privilege
  become_method: sudo       # Set become method
  remote_user: root         # Update username for remote server
  vars:
    tomcat_ver: 9.0.64                          # Tomcat version to install
    tomcat_v_num: 9                             # Tomcat version number
    ui_manager_user: manager                    # User who can access the UI manager section only
    ui_manager_pass: Str0ngManagerP@ssw3rd      # UI manager user password
    ui_admin_username: admin                    # User who can access bpth manager and admin UI sections
    ui_admin_pass: Str0ngAdminP@ssw3rd          # UI admin password
  roles:
    - tomcat

If you are using non root remote user, then set username and enable sudo:

become: yes
become_method: sudo

Running Playbook

Once all values are updated, you can then run the playbook against your nodes.

Playbook executed as root user - with ssh key:

$ ansible-playbook -i hosts tomcat-setup.yml

Playbook executed as root user - with password:

$ ansible-playbook -i hosts tomcat-setup.yml --ask-pass

Playbook executed as sudo user - with password:

$ ansible-playbook -i hosts tomcat-setup.yml --ask-pass --ask-become-pass

Playbook executed as sudo user - with ssh key and sudo password:

$ ansible-playbook -i hosts tomcat-setup.yml --ask-become-pass

Playbook executed as sudo user - with ssh key and passwordless sudo:

$ ansible-playbook -i hosts tomcat-setup.yml --ask-become-pass

Execution should be successful without errors:

About

Ansible Role to install tomcat o Debian, Ubuntu, Fedora and CentOS Linux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jinja 100.0%