Skip to content
Snippets Groups Projects
Unverified Commit f0b3c79f authored by Imran Iqbal's avatar Imran Iqbal Committed by GitHub
Browse files

Merge pull request #109 from danny-smit/debian10

Rework map.jinja according to the template-formula and add support for Debian 10
parents 43fc17a5 9b2bab53
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,7 @@ jobs:
## Define the rest of the matrix based on Kitchen testing
# Make sure the instances listed below match up with
# the `platforms` defined in `kitchen.yml`
# - env: INSTANCE=tomcat-install-debian-10-master-py3
- env: INSTANCE=tomcat-install-debian-10-master-py3
- env: INSTANCE=tomcat-install-ubuntu-1804-master-py3
# - env: INSTANCE=tomcat-extend-ubuntu-1804-master-py3
# - env: INSTANCE=tomcat-install-centos-8-master-py3
......
......@@ -12,7 +12,7 @@ ignore: |
node_modules/
test/**/states/**/*.sls
.kitchen/
tomcat/osmap.yaml
tomcat/osfamilymap.yaml
yaml-files:
# Default settings
......
......@@ -7,7 +7,12 @@ control 'Tomcat packages' do
packages =
case platform[:family]
when 'debian'
case platform[:release]
when /^10/
%w[tomcat9 haveged]
else
%w[tomcat8 haveged]
end
when 'redhat', 'fedora', 'suse'
%w[tomcat]
end
......
......@@ -8,7 +8,12 @@ control 'Tomcat services' do
services =
case platform[:family]
when 'debian'
case platform[:release]
when /^10/
%w[tomcat9 haveged]
else
%w[tomcat8 haveged]
end
when 'redhat', 'fedora', 'suse'
%w[tomcat]
end
......
......@@ -7,7 +7,28 @@ control 'Tomcat `map.jinja` YAML dump' do
yaml_dump +=
case platform[:family]
when 'debian'
case platform[:release]
when /^10/
conf_dir = '/etc/tomcat9'
group = 'tomcat'
main_config = '/etc/default/tomcat9'
manager_pkg = 'tomcat9-admin'
pkg = 'tomcat9'
service = 'tomcat9'
user = 'tomcat'
ver = 9
else
conf_dir = '/etc/tomcat8'
group = 'tomcat8'
main_config = '/etc/default/tomcat8'
manager_pkg = 'tomcat8-admin'
pkg = 'tomcat8'
service = 'tomcat8'
user = 'tomcat8'
ver = 8
end
<<~YAML_DUMP.chomp
arch: amd64
authbind: 'no'
catalina_base: /usr/share/tomcat
catalina_home: /usr/share/tomcat
......@@ -15,7 +36,7 @@ control 'Tomcat `map.jinja` YAML dump' do
catalina_tmpdir: /var/cache/tomcat/temp
cluster:
simple: true
conf_dir: /etc/tomcat8
conf_dir: #{conf_dir}
connectors:
example_connector:
port: 8443
......@@ -72,7 +93,7 @@ control 'Tomcat `map.jinja` YAML dump' do
global: simpleValue
type: java.lang.Integer
expires_when: 2 weeks
group: tomcat8
group: #{group}
haveged_enabled: true
id:
- example.com
......@@ -91,7 +112,7 @@ control 'Tomcat `map.jinja` YAML dump' do
soft: 64000
logfile_compress: 1
logfile_days: 14
main_config: /etc/default/tomcat8
main_config: #{main_config}
main_config_template: salt://tomcat/files/tomcat-default-Debian.template
manager:
roles:
......@@ -110,7 +131,7 @@ control 'Tomcat `map.jinja` YAML dump' do
- manager-script
- manager-jmx
- manager-status
manager_pkg: tomcat8-admin
manager_pkg: #{manager_pkg}
native_pkg: libtcnative-1
other_contexts:
other-contexts:
......@@ -137,10 +158,10 @@ control 'Tomcat `map.jinja` YAML dump' do
className: org.apache.catalina.webresources.DirResourceSet
base: /var/lib/tomcat8/appconfig
webAppMount: /WEB-INF/classes
pkg: tomcat8
pkg: #{pkg}
resources: {}
security: 'no'
service: tomcat8
service: #{service}
service_enabled: true
service_running: false
sites:
......@@ -175,12 +196,13 @@ control 'Tomcat `map.jinja` YAML dump' do
pattern: '%h %l %u %t &quot;%m http://%v%U %H&quot; %s %b &quot;%{Referer}i&quot;
&quot;%{User-Agent}i&quot; %D'
- className: org.apache.catalina.authenticator.SingleSignOn
user: tomcat8
ver: 8
user: #{user}
ver: #{ver}
with_haveged: true
YAML_DUMP
when 'redhat', 'fedora'
<<~YAML_DUMP.chomp
arch: amd64
authbind: 'no'
catalina_base: /usr/share/tomcat
catalina_home: /usr/share/tomcat
......@@ -354,6 +376,7 @@ control 'Tomcat `map.jinja` YAML dump' do
YAML_DUMP
when 'suse'
<<~YAML_DUMP.chomp
arch: amd64
authbind: 'no'
catalina_base: /usr/share/tomcat
catalina_home: /usr/share/tomcat
......
# -*- coding: utf-8 -*-
# vim: ft=jinja
{% import_yaml "tomcat/defaults.yaml" as defaults %}
{% import_yaml "tomcat/osmap.yaml" as osmap %}
{% import_yaml "tomcat/codenamemap.yaml" as codemap %}
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{#- Start imports as #}
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
{# get the settings for the os_family grain #}
{% set osfam = salt['grains.filter_by'](osmap) or {} %}
{# get the settings for the oscodename grain, os_family data will override
oscodename data #}
{% set oscode = salt['grains.filter_by'](codemap,
grain='oscodename',
merge=osfam) or {} %}
{#- Retrieve the config dict only once #}
{%- set _config = salt['config.get'](tplroot, default={}) %}
{# merge the os family/codename specific data over the defaults #}
{% do defaults.tomcat.update(oscode) %}
{%- set defaults = salt['grains.filter_by'](
default_settings,
default=tplroot,
merge=salt['grains.filter_by'](
osarchmap,
grain='osarch',
merge=salt['grains.filter_by'](
osfamilymap,
grain='os_family',
merge=salt['grains.filter_by'](
osmap,
grain='os',
merge=salt['grains.filter_by'](
osfingermap,
grain='osfinger',
merge=salt['grains.filter_by'](
_config,
default='lookup'
)
)
)
)
)
)
%}
{# merge the pillar:lookup dict into the defaults/os specific dict #}
{% set lookup = salt['pillar.get']('tomcat:lookup',
default=defaults.tomcat,
merge=True) %}
{%- set config = salt['grains.filter_by'](
{'defaults': defaults},
default='defaults',
merge=_config
)
%}
{# merge the actual tomcat pillar into the above combined dict #}
{% set tomcat = salt['pillar.get']('tomcat', default=lookup, merge=True) %}
{%- set tomcat = config %}
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['osarch'] based logic.
# You just need to add the key:values for an `osarch` that differ
# from `defaults.yaml`.
# Only add an `osarch` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `osarch` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osarch: {}
---
amd64:
arch: amd64
x86_64:
arch: amd64
386:
arch: 386
arm64:
arch: arm64
armv6l:
arch: armv6l
armv7l:
arch: armv7l
ppc64le:
arch: ppc64le
s390x:
arch: s390x
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
Debian:
ver: 8
pkg: tomcat8
native_pkg: libtcnative-1
manager_pkg: tomcat8-admin
with_haveged: true
haveged_enabled: true
conf_dir: /etc/tomcat8
main_config: /etc/default/tomcat8
main_config_template: salt://tomcat/files/tomcat-default-Debian.template
service: tomcat8
user: tomcat8
group: tomcat8
java_home: /usr/lib/jvm/default-java
RedHat:
native_pkg: tomcat-native
manager_pkg: tomcat-admin-webapps
main_config_template: salt://tomcat/files/tomcat-default-CentOS.template
Suse:
ver: 8
native_pkg: libtcnative-1-0
manager_pkg: tomcat-admin-webapps
main_config_template: salt://tomcat/files/tomcat-default-CentOS.template
Gentoo: {}
Arch:
pkg: tomcat8
ver: 8
service: tomcat8
native_pkg: tomcat-native
conf_dir: /etc/tomcat8
main_config: /usr/lib/systemd/system/tomcat8.service
main_config_template: salt://tomcat/files/tomcat-default-Arch.template
user: tomcat8
group: tomcat8
java_home: /usr/lib/jvm/default-runtime
jvm_tmp: /var/tmp/tomcat8/temp
catalina_pid: /var/run/tomcat8.pid
catalina_base: /usr/share/tomcat8
catalina_home: /usr/share/tomcat8
# Not used on Arch
manager_pkg: ''
Alpine: {}
FreeBSD:
native_pkg: tomcat-native
ini_config: /etc/rc.conf
java_home: /usr
OpenBSD: {}
Solaris: {}
Windows: {}
{%- if grains.os == 'MacOS' %}
{%- if salt['cmd.run']('/usr/libexec/java_home -F', output_loglevel="quiet") == 0 %}
{%- set darwin_javahome = salt['cmd.run']('/usr/libexec/java_home') %}
{%- else %}
{%- set darwin_javahome = "" %}
{%- endif %}
MacOS:
# yamllint disable rule:line-length
user: {{ salt['pillar.get']('tomcat:user', salt['cmd.run']("stat -f '%Su' /dev/console")) }}
group: {{ salt['pillar.get']('tomcat:group', salt['cmd.run']("stat -f '%Sg' /dev/console")) }}
# yamllint enable rule:line-length
java_home: {{ darwin_javahome }}
service: homebrew.mxcl.tomcat
ver: 8
pkg: tomcat
native_pkg: tomcat-native
conf_dir: /usr/local/opt/tomcat/libexec/conf
main_config: /usr/local/opt/tomcat/libexec/bin/setenv.sh
main_config_template: salt://tomcat/files/tomcat-default-CentOS.template
limits_prefix: /Library/LaunchAgents/maxfiles.plist
jvm_tmp: /usr/local/opt/tomcat/libexec/temp
catalina_base: /usr/local/opt/tomcat/libexec
catalina_home: /usr/local/opt/tomcat/libexec
catalina_tmpdir: /usr/local/opt/tomcat/libexec/temp
# Not used on Darwin
manager_pkg: ''
with_haveged: false
haveged_enabled: false
# Not verified on Darwin
cluster:
simple: false
{%- endif %}
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
trusty:
ver: 7
# os: Debian
Debian-10:
ver: 9
pkg: tomcat9
manager_pkg: tomcat9-admin
conf_dir: /etc/tomcat9
main_config: /etc/default/tomcat9
service: tomcat9
user: tomcat
group: tomcat
Debian-9: {}
Debian-8: {}
Debian-7:
pkg: tomcat7
manager_pkg: tomcat7-admin
conf_dir: /etc/tomcat7
......@@ -11,7 +22,12 @@ trusty:
service: tomcat7
user: tomcat7
group: tomcat7
wheezy:
# os: Ubuntu
Ubuntu-18.04: {}
Ubuntu-16.04: {}
Ubuntu-14.04:
ver: 7
pkg: tomcat7
manager_pkg: tomcat7-admin
conf_dir: /etc/tomcat7
......@@ -20,3 +36,28 @@ wheezy:
service: tomcat7
user: tomcat7
group: tomcat7
# os: Fedora
Fedora-31: {}
Fedora-30: {}
# os: CentOS
CentOS Linux-8: {}
CentOS Linux-7: {}
CentOS-6: {}
# os: Amazon
Amazon Linux-2: {}
Amazon Linux AMI-2018: {}
# os: SUSE
Leap-15: {}
# os: FreeBSD
FreeBSD-12: {}
# os: Windows
Windows-8.1: {}
# os: Gentoo
Gentoo-2: {}
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Setup variables using grains['os'] based logic.
# You just need to add the key:values for an `os` that differ
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml`.
# Only add an `os` which is/will be supported by the formula.
#
# If you do not need to provide defaults via the `os` grain,
# you will need to provide at least an empty dict in this file, e.g.
# osmap: {}
---
Debian:
ver: 8
pkg: tomcat8
native_pkg: libtcnative-1
manager_pkg: tomcat8-admin
with_haveged: true
haveged_enabled: true
conf_dir: /etc/tomcat8
main_config: /etc/default/tomcat8
main_config_template: salt://tomcat/files/tomcat-default-Debian.template
service: tomcat8
user: tomcat8
group: tomcat8
java_home: /usr/lib/jvm/default-java
RedHat:
native_pkg: tomcat-native
manager_pkg: tomcat-admin-webapps
main_config_template: salt://tomcat/files/tomcat-default-CentOS.template
CentOS:
native_pkg: tomcat-native
manager_pkg: tomcat-admin-webapps
main_config_template: salt://tomcat/files/tomcat-default-CentOS.template
openSUSE:
ver: 8
native_pkg: libtcnative-1-0
manager_pkg: tomcat-admin-webapps
main_config_template: salt://tomcat/files/tomcat-default-CentOS.template
Suse:
ver: 8
native_pkg: libtcnative-1-0
manager_pkg: tomcat-admin-webapps
main_config_template: salt://tomcat/files/tomcat-default-CentOS.template
FreeBSD:
native_pkg: tomcat-native
ini_config: /etc/rc.conf
java_home: /usr
Arch:
pkg: tomcat8
ver: 8
service: tomcat8
native_pkg: tomcat-native
conf_dir: /etc/tomcat8
main_config: /usr/lib/systemd/system/tomcat8.service
main_config_template: salt://tomcat/files/tomcat-default-Arch.template
user: tomcat8
group: tomcat8
java_home: /usr/lib/jvm/default-runtime
jvm_tmp: /var/tmp/tomcat8/temp
catalina_pid: /var/run/tomcat8.pid
catalina_base: /usr/share/tomcat8
catalina_home: /usr/share/tomcat8
# Not used on Arch
manager_pkg: ''
# os_family: Debian
Ubuntu: {}
Raspbian: {}
{%- if grains.os == 'MacOS' %}
{%- if salt['cmd.run']('/usr/libexec/java_home -F', output_loglevel="quiet") == 0 %}
{%- set darwin_javahome = salt['cmd.run']('/usr/libexec/java_home') %}
{%- else %}
{%- set darwin_javahome = "" %}
{%- endif %}
MacOS:
# yamllint disable rule:line-length
user: {{ salt['pillar.get']('tomcat:user', salt['cmd.run']("stat -f '%Su' /dev/console")) }}
group: {{ salt['pillar.get']('tomcat:group', salt['cmd.run']("stat -f '%Sg' /dev/console")) }}
# yamllint enable rule:line-length
# os_family: RedHat
Fedora: {}
CentOS: {}
Amazon: {}
java_home: {{ darwin_javahome }}
service: homebrew.mxcl.tomcat
ver: 8
pkg: tomcat
native_pkg: tomcat-native
conf_dir: /usr/local/opt/tomcat/libexec/conf
main_config: /usr/local/opt/tomcat/libexec/bin/setenv.sh
main_config_template: salt://tomcat/files/tomcat-default-CentOS.template
limits_prefix: /Library/LaunchAgents/maxfiles.plist
jvm_tmp: /usr/local/opt/tomcat/libexec/temp
catalina_base: /usr/local/opt/tomcat/libexec
catalina_home: /usr/local/opt/tomcat/libexec
catalina_tmpdir: /usr/local/opt/tomcat/libexec/temp
# os_family: Suse
SUSE: {}
openSUSE: {}
# Not used on Darwin
manager_pkg: ''
with_haveged: false
haveged_enabled: false
# os_family: Gentoo
Funtoo: {}
# Not verified on Darwin
cluster:
simple: false
# os_family: Arch
Manjaro: {}
{%- endif %}
# os_family: Solaris
SmartOS: {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment