Giter VIP home page Giter VIP logo

tomcat_role's Introduction

Logo

Build Status Ansible Galaxy

Tomcat Ansible role

This ansible role installs a Tomcat server in a debian environment.

Getting Started

These instructions will get you a copy of the role for your ansible playbook. Once launched, it will install a Tomcat server in a Debian system. Supported tomcat versions:

  • 7.x
  • 8.x
  • 8.5.x
  • 9.x

Supported OS:

  • Debian:
    • Stretch
    • Buster
  • Ubuntu
    • Focal

Prerequisities

For compatible Ansible versions check .travis.yml. Inventory destination should be a Debian environment.

For testing purposes, Molecule with Docker as driver and Goss as verifier This role needs a system with java previously installed. Its really recommended the use of idealista's java role for that purpose: idealista.java-role

Installing

Create or add to your roles dependency file (e.g requirements.yml) from GitHub:

- src: http://github.com/idealista/tomcat_role.git
  scm: git
  version: 1.0.0
  name: tomcat

or using Ansible Galaxy as origin if you prefer:

- src: idealista.tomcat_role
  version: 1.0.0
  name: tomcat

Install the role with ansible-galaxy command:

ansible-galaxy install -p roles -r requirements.yml -f

Use in a playbook:

- hosts: someserver
  roles:
    - { role: tomcat }

Usage

Look to the defaults properties file to see the possible configuration properties.

Testing

Install dependencies

pipenv sync
pipenv shell

For more information read the pipenv docs.

Running test

molecule test

See molecule/molecule.yml to check possible testing platforms.

Works With

Ansible Molecule Goss

Versioning

For the versions available, see the tags on this repository.

Additionaly you can see what change in each version in the CHANGELOG.md file.

Authors

See also the list of contributors who participated in this project.

License

Apache 2.0 License

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

tomcat_role's People

Contributors

agimenez avatar antonioarenzanapulido avatar blalop avatar dependabot[bot] avatar dortegau avatar jdvr avatar jmonterrubio avatar sorobon avatar vicsufer avatar yaragomezsaiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tomcat_role's Issues

Follow OWASP recommendations to protect Shutdown port

Prerequisites

Description

OWASP recommends to change SHUTDOWN command word from 'SHUTDOWN' to other ('ReallyComplexWord' xd)

Expected behavior: SHUTDOWN command should be configurable

Actual behavior: We cannot change SHUTDOWN command because is hardcoded in the server.xml.j2 template

Versions

All

Additional Information

OWASP - Protecting the Shutdown port

Adding testing scenarios for tomcat 7.x and 8.x

Prerequisites

Description

As Tomcat 7.x and Tomcat 8.x are currently mantained versions of Tomcat, it would be nice to add scenarios testing that are supported versions that could be installed using this role. These versions should be explicitly specified as supported versions in the Readme file

Improve agents management

Prerequisites

Description

When you run the role twice it will download and configure the agent every run.

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior: Only do things when its necessary.

Actual behavior: Download and configure the agent every time.

Reproduces how often: Always

Versions

Since 1.5.x

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Download and rename war before copy to webapps

Prerequisites

Description

During deploy the role downloads a war and copy it to webapps folder without modifying the name. This is is a problem because some projects wars name usually includes other information like profile or version that should be remove when copied to webapps

Expected behavior:
The role should be able to process a list of war urls with a destination name. Download the war and copy it to webapps with desire destination name.

[BUG] Agent jar installation not working correctly

Description

When installing a java jar agent directly the configuration section is not working as intended.

Environment

  • The release version/s you are using:
  • OS:
  • Others:

Additional Information

[Any additional information, configuration or data that might be necessary to reproduce the issue.]

Also allow copies on the target machine by honoring remote_src: yes

- name: Tomcat | Copy local wars to webapps
copy:
src: "{{ item }}"
dest: "{{ tomcat_webapps_path }}"
mode: 0755
owner: "{{ tomcat_user }}"
group: "{{ tomcat_group }}"
with_items: "{{ tomcat_war_to_deploy_path }}"
when: tomcat_local_wars

Hi,

the current implementation allows only to deploy from the control node to the target node. But sometimes the war file might already be available on that target machine so it should be possible to also define if the parameter remote_src should be used or not.

Like this:

- name: Tomcat | Copy local wars to webapps
  copy:
    src: "{{ item }}"
    dest: "{{ tomcat_webapps_path }}"
    mode: 0755
    owner: "{{ tomcat_user }}"
    group: "{{ tomcat_group }}"
    remote_src: "{{ tomcat_war_to_deploy_use_remote_src }}"
  with_items: "{{ tomcat_war_to_deploy_path }}"
  when: tomcat_local_wars

Please support EL

Prerequisites

Description

Most of the tasks can work just fine in EL, except for the apt step in deploy, from what I can tell. Please add support for EL.

Steps to Reproduce

  1. Run on EL
  2. Find failures
  3. Fix

Expected behavior:
Success

Actual behavior:
Failure

Reproduces how often:
100%

Versions

1.8.0

Additional Information

N/A

[BUG] Role fails when two agents are installed in different periods of time

Description

Role fails when two agents are installed in two separated periods of time. More info in the section below.

Steps to Reproduce

  1. Run the role and install an agent
  2. Empty /tmp
  3. Run the role installing a second agent, in addition to the first one

Expected behavior:
Do not fail in step 3, installing the two agents successfully

Actual behavior:
Role fails in the first run, making it mandatory to run the role twice in order to have a proper execution

Reproduces how often:
100%

Environment

N/A

Additional Information

N/A

Add an option to use maven artifact module to download wars

Prerequisites

Description

get_url module doesn't work properly on different version but same name war downloaded.

Steps to Reproduce

  1. Download any war version
  2. Download other war version but with same name
  3. The get_url module doesn't override the file

Add support for "addons"

Description

I need support for addons like java agents (newrelic, datadog, etc.) in this role.

Expected behavior: With the provided configuration I expect not to do more modifications when this role is executed.

Actual behavior: I need to modify the configuration after this role is executed.

Versions

All versions

Improve systemd template adding limits

Prerequisites

Description

Systemd ignores limits.d configuration managing services. The cassandra.service template can be improved in order to add, at least:

memlock
nofile
as
nproc

Steps to Reproduce

  1. systemct start cassandra

Expected behavior:
Get configured limits.

Actual behavior:
Limits not configured.

Reproduces how often:
Always.

Versions

All

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Deploy task

After installing and configure tomcat it would be good to have a task that copy wars to CATALINA_HOME/webapps .

Cannot copy extra tomcat config recursively

Prerequisites

Description

Cannot copy extra tomcat config recursively

Steps to Reproduce

  1. Create a folder inside tomcat_extra_conf_path (playbook_path/templates/tomcat/conf/Catalina/localhost/)
  2. Put your configuration template in that folder

Expected behavior: That template should be copied in that path

Actual behavior: Folders declared in step one are created but the config template is not copied

Reproduces how often: always

Versions

all

Support for agent extensions

Description

Some java agents supports extensions to add more functionality. This role doesn't support it yet.

Why is this needed?

The role supports java agents but extensions not yet.

[BUG] Default systemd security limits error

Description

Memlock and AS security limits have a default value "unlimited" but systemd changed traditional syntax and use "infinity" value.

Steps to Reproduce

  1. Use limits default values from role.
  2. Start service.

Expected behavior:
Limits are set to unlimit.

Actual behavior:
Systemd warns limit values are not recognized.
Reproduces how often:
Always.

Environment

  • The release version/s you are using:
  • OS: all

Additional Information

N/A

Systemd is not working

Prerequisites

Description

Systemd notice the service is started but the applications managed aren't started.

Steps to Reproduce

  1. $ sudo systemctl start tomcat.service

Actual behavior: Tomcat managed services doesn't start

Reproduces how often: Always

Versions

1.1.0

Use Goss instead Testinfra and increase/improve test coverage

Prerequisites

Description

We should use Goss instead Testinfra to check:

  • Default tomcat port is opened (8080)
  • Default shutdown port is opened (8009) (and not opened if it's configured with '-1' value in other scenario). Check that configured shutdown command also works.
  • Tomcat version
  • Tomcat user exists
  • Tomcat service is running
  • Tomcat is up and running (HTTP check) with sample.war
  • Pre-installed folders are deleted if are configured as 'not deployed' (other scenario IMHO)
  • Extra configuration is copied when is provided as file or template under playbook_dir

Additional Information

Goss

Allow to change logs dir

Prerequisites

Description

I want to change the path of the log files to another directory like '/var/log/tomcat/' or something else.

Expected behavior: With a variable I want to set the log files destination.

Actual behavior: Once installed, the log files are placed in "{{ installation_path }}/logs"

Versions

All versions

Download wars from maven task with unexpected results in Ansible 2.6

Prerequisites

Description

Due to the inclusion of verify_checksum argument in maven_artifact module in Ansible 2.6 (https://docs.ansible.com/ansible/2.6/modules/maven_artifact_module.html#verify_checksum), the module doesn't verify the checksum of the WAR if it is already downloaded by default, making it impossible to update it if the artifact_id is identical.

Steps to Reproduce

  1. Use the role with Ansible 2.6 to download a war from a repository.
  2. Make changes in such WAR.
  3. Run the role again.

Expected behavior: The WAR to be updated.

Actual behavior: The WAR is not updated.

Reproduces how often: Always

Versions

All.

Allow the option to pass additional environment vars

Prerequisites

Description

Need to add the option to add environment variables as the same way we can configure the catalina_opts variable.

Expected behavior: Add a variable in the configuration (main.yml or whatever) and configure the tomcat instance to use it.

Actual behavior: Not able to pass the variable and I must to add additional steps to configure the tomcat instance.

Reproduces how often: Allways

Versions

All

The version/s you notice the behavior.

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Copy extra conf task doesn't work properly

Prerequisites

Description

TASK [tomcat : Tomcat | Copy extra tomcat config templates (provided by playbooks)] ********************************
failed: [target.cont] (item=playbooks/templates/tomcat/conf/context.xml) => {"failed": true, "item": "playbooks/templates/tomcat/conf/context.xml", "msg": "Unable to find 'playbooks/templates/tomcat/conf/context.xml.j2' in expected paths."}

Steps to Reproduce

  1. Create a templates/tomcat/conf directory
  2. Add any file no matter extesion
  3. The roles is not able to copy the file it always tries to add a ".j2" at the end of the file.
    https://github.com/idealista/tomcat-role/blob/c1c18e3787996819e11c6d880f66c8b2c632755c/tasks/config.yml#L28

Maven downloaded wars wrong owner

Prerequisites

Description

Maven Downloaded war belongs to root

Steps to Reproduce

  1. Enable maven war downloaded
  2. Download any war from maven
  3. webapps/any.war user and group is root

Expected behavior: Download war should belongs to tomcat_userand tomcat_group

Actual behavior: war belongs to current ansible task runner (usually root)

Reproduces how often: Always

Versions

1.3.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.