robertdebock / ansible-role-tomcat

Install and configure tomcat on your system.
https://robertdebock.nl/
Apache License 2.0
46 stars 57 forks source link

Configurable version and versions #27

Closed onknows closed 3 years ago

onknows commented 3 years ago

Proposed feature

Make downloads url configurable. Currently we cannot configure alternate tomcat download urls.

Basically move config vars/main.yml to defaults/main.yml

Personally I prefer config in that location for example as follows

tomcat_version: 7.0.104
tomcat_versions: 
  7.0.104:
    url: https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.36/bin/apache-tomcat-9.0.36.tar.gz
    checksum: sha256:****

Users can then add their own versions without having to change robertdebock.tomcat.

Rationale

Currently this role does not allow us to configure an alternative tomcat_unarchive_url. More often than note in specific industry I am working in, it is not allowed to download from internet. So we download manually, transfer the binary to a "mirror" that we host internally.

Ideally we can configure our own tomcat_version and tomcat_versions. Without having to change robertdobock.tomcat.

Additional context

I mostly consider the way config in vars works an Ansible bug. Config in an Ansible role that is not your own should always have a low precedence. You should be able to override config in a role in groups_vars, host_vars etc.

Compared to Chef config in vars are like "override" attributes. These are not often used. Because of the fact that Ansible gives config in vars the highest precedence, config in vars in roles should not be used unless absolutely necessary.

robertdebock commented 3 years ago

Yes, you are completely correct. I'll move the versions related stuff to defaults/main.yml. Give me a moment.

robertdebock commented 3 years ago

I've release a new version that contains your suggestion. Let me know if that works for you.