diff --git a/.rubocop.yml b/.rubocop.yml index 3a1f7aa3..1823d924 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -23,6 +23,3 @@ AllCops: Lint/EmptyWhen: Exclude: - test/integration/default/controls/config_spec.rb -Style/FormatStringToken: - Exclude: - - test/integration/default/controls/yaml_dump_spec.rb diff --git a/CODEOWNERS b/CODEOWNERS index 093bb854..91d61559 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -10,7 +10,6 @@ # SECTION: Owner(s) for specific directories # FILE PATTERN OWNER(S) -/test/ @myii # SECTION: Owner(s) for files/directories related to `semantic-release` # FILE PATTERN OWNER(S) @@ -20,8 +19,11 @@ /docs/AUTHORS.rst @saltstack-formulas/ssf /docs/CHANGELOG.rst @saltstack-formulas/ssf /docs/TOFS_pattern.rst @saltstack-formulas/ssf +/*/_mapdata/ @saltstack-formulas/ssf /*/libsaltcli.jinja @saltstack-formulas/ssf /*/libtofs.jinja @saltstack-formulas/ssf +/test/integration/**/_mapdata_spec.rb @saltstack-formulas/ssf +/test/integration/**/libraries/system.rb @saltstack-formulas/ssf /test/integration/**/inspec.yml @saltstack-formulas/ssf /test/integration/**/README.md @saltstack-formulas/ssf /.gitignore @saltstack-formulas/ssf diff --git a/kitchen.yml b/kitchen.yml index 35e5683c..8473ca5c 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -149,11 +149,13 @@ verifier: suites: - name: default + driver: + hostname: example.net provisioner: state_top: base: '*': - - tomcat.yaml_dump + - tomcat._mapdata - tomcat - tomcat.native - tomcat.config @@ -169,9 +171,6 @@ suites: - tomcat pillars_from_files: tomcat.sls: pillar.example - dependencies: - - name: comparison_files - path: ./test/salt verifier: inspec_tests: - path: test/integration/default diff --git a/test/integration/default/controls/_mapdata_spec.rb b/test/integration/default/controls/_mapdata_spec.rb new file mode 100644 index 00000000..64635323 --- /dev/null +++ b/test/integration/default/controls/_mapdata_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'yaml' + +control '`map.jinja` YAML dump' do + title 'should match the comparison file' + + ### Method + # The steps below for each file appear convoluted but they are both required + # and similar in nature: + # 1. The earliest method was to simply compare the files textually but this often + # led to false positives due to inconsistencies (e.g. spacing, ordering) + # 2. The next method was to load the files back into YAML structures and then + # compare but InSpec provided block diffs this way, unusable by end users + # 3. The final step was to dump the YAML structures back into a string to use + # for the comparison; this both worked and provided human-friendly diffs + + ### Comparison file for the specific platform + ### Static, adjusted as part of code contributions, as map data is changed + # Strip the `platform[:finger]` version number down to the "OS major release" + platform_finger = system.platform[:finger].split('.').first.to_s + # Use that to set the path to the file (relative to the InSpec suite directory) + mapdata_file_path = "_mapdata/#{platform_finger}.yaml" + # Load the mapdata from profile, into a YAML structure + # https://docs.chef.io/inspec/profiles/#profile-files + mapdata_file_yaml = YAML.safe_load(inspec.profile.file(mapdata_file_path)) + # Dump the YAML back into a string for comparison + mapdata_file_dump = YAML.dump(mapdata_file_yaml) + + ### Output file produced by running the `_mapdata` state + ### Dynamic, generated during Kitchen's `converge` phase + # Derive the location of the dumped mapdata (differs for Windows) + output_dir = platform[:family] == 'windows' ? '/temp' : '/tmp' + # Use that to set the path to the file (absolute path, i.e. within the container) + output_file_path = "#{output_dir}/salt_mapdata_dump.yaml" + # Load the output into a YAML structure using InSpec's `yaml` resource + # https://github.com/inspec/inspec/blob/49b7d10/lib/inspec/resources/yaml.rb#L29 + output_file_yaml = yaml(output_file_path).params + # Dump the YAML back into a string for comparison + output_file_dump = YAML.dump(output_file_yaml) + + describe 'File content' do + it 'should match profile map data exactly' do + expect(output_file_dump).to eq(mapdata_file_dump) + end + end +end diff --git a/test/integration/default/controls/config_spec.rb b/test/integration/default/controls/config_spec.rb index 0cd0cd8a..322d405b 100644 --- a/test/integration/default/controls/config_spec.rb +++ b/test/integration/default/controls/config_spec.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true -# Prepare platform "finger" and base path to file comparison directory -platform_finger = "#{platform[:name]}-#{platform[:release].split('.')[0]}" -comparison_files_dir = '/tmp/kitchen/srv/salt/comparison_files' +# Strip the `platform[:finger]` version number down to the "OS major release" +platform_finger = system.platform[:finger].split('.').first.to_s # Default values for `control 'Tomcat main config'` main_config_file = '/etc/sysconfig/tomcat' @@ -67,8 +66,8 @@ title 'should contain the lines' # Prepare comparison file - main_config_path = "#{comparison_files_dir}/main_config/#{platform_finger}" - main_config = file(main_config_path).content + main_config_path = "main_config/#{platform_finger}" + main_config = inspec.profile.file(main_config_path) describe file(main_config_file) do it { should be_file } @@ -94,13 +93,8 @@ title 'should contain the lines' server_xml_file = "#{conf_dir}/server.xml" - server_xml_path = "#{comparison_files_dir}/server_xml/#{platform_finger}.xml" - server_xml = file(server_xml_path).content - # Need the hostname to be used for `tomcat.cluster` - server_xml = server_xml.gsub( - 'HOSTNAME_PLACEHOLDER', - file('/etc/hostname').content.chomp - ) + server_xml_path = "server_xml/#{platform_finger}.xml" + server_xml = inspec.profile.file(server_xml_path) describe file(server_xml_file) do it { should be_file } diff --git a/test/integration/default/controls/packages_spec.rb b/test/integration/default/controls/packages_spec.rb index 192d31bf..740ca518 100644 --- a/test/integration/default/controls/packages_spec.rb +++ b/test/integration/default/controls/packages_spec.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -# Prepare platform "finger" -platform_finger = "#{platform[:name]}-#{platform[:release].split('.')[0]}" - control 'Tomcat packages' do title 'should be installed' + # Strip the `platform[:finger]` version number down to the "OS major release" + platform_finger = system.platform[:finger].split('.').first.to_s + # Overide by platform packages = case platform[:family] diff --git a/test/integration/default/controls/services_spec.rb b/test/integration/default/controls/services_spec.rb index 8bab4271..c2664cc4 100644 --- a/test/integration/default/controls/services_spec.rb +++ b/test/integration/default/controls/services_spec.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -# Prepare platform "finger" -platform_finger = "#{platform[:name]}-#{platform[:release].split('.')[0]}" - control 'Tomcat services' do impact 0.5 title 'should be installed, enabled and running' + # Strip the `platform[:finger]` version number down to the "OS major release" + platform_finger = system.platform[:finger].split('.').first.to_s + # Overide by platform services = case platform[:family] diff --git a/test/integration/default/controls/yaml_dump_spec.rb b/test/integration/default/controls/yaml_dump_spec.rb deleted file mode 100644 index 3e07d25e..00000000 --- a/test/integration/default/controls/yaml_dump_spec.rb +++ /dev/null @@ -1,592 +0,0 @@ -# frozen_string_literal: true - -# Prepare platform "finger" -platform_finger = "#{platform[:name]}-#{platform[:release].split('.')[0]}" - -control 'Tomcat `map.jinja` YAML dump' do - title 'should contain the lines' - - yaml_dump = "---\n" - yaml_dump += - case platform[:family] - when 'debian' - case platform_finger - when 'debian-10', 'ubuntu-20' - conf_dir = '/etc/tomcat9' - group = 'tomcat' - main_config = '/etc/default/tomcat9' - manager_pkg = 'tomcat9-admin' - pkg = 'tomcat9' - service = 'tomcat9' - user = 'tomcat' - ver = 9 - catalina_base = '/var/lib/tomcat9' - catalina_home = '/usr/share/tomcat9' - catalina_pid = '/var/run/tomcat9.pid' - catalina_tmpdir = '/var/cache/tomcat9/temp' - common_pkg = 'tomcat9-common' - when 'debian-9', 'ubuntu-18', 'ubuntu-16' - conf_dir = '/etc/tomcat8' - group = 'tomcat8' - main_config = '/etc/default/tomcat8' - manager_pkg = 'tomcat8-admin' - pkg = 'tomcat8' - service = 'tomcat8' - user = 'tomcat8' - ver = 8 - catalina_base = '/var/lib/tomcat8' - catalina_home = '/usr/share/tomcat8' - catalina_pid = '/var/run/tomcat8.pid' - catalina_tmpdir = '/var/cache/tomcat8/temp' - common_pkg = 'tomcat8-common' - when 'debian-8' - conf_dir = '/etc/tomcat7' - group = 'tomcat7' - main_config = '/etc/default/tomcat7' - manager_pkg = 'tomcat7-admin' - pkg = 'tomcat7' - service = 'tomcat7' - user = 'tomcat7' - ver = 7 - catalina_base = '/var/lib/tomcat7' - catalina_home = '/usr/share/tomcat7' - catalina_pid = '/var/run/tomcat7.pid' - catalina_tmpdir = '/var/cache/tomcat7/temp' - common_pkg = 'tomcat7-common' - end - <<~YAML_DUMP.chomp - arch: amd64 - authbind: 'no' - catalina_base: #{catalina_base} - catalina_home: #{catalina_home} - catalina_pid: #{catalina_pid} - catalina_tmpdir: #{catalina_tmpdir} - cluster: - simple: true - common_pkg: #{common_pkg} - conf_dir: #{conf_dir} - connectors: - example_connector: - port: 8443 - protocol: org.apache.coyote.http11.Http11Protocol - connectionTimeout: 20000 - URIEncoding: UTF-8 - redirectPort: 8443 - maxHttpHeaderSize: 8192 - maxThreads: 150 - minSpareThreads: 25 - enableLookups: 'false' - disableUploadTimeout: 'true' - acceptCount: 100 - scheme: https - secure: 'true' - clientAuth: 'false' - sslProtocol: TLS - SSLEnabled: 'false' - keystoreFile: /path/to/keystoreFile - keystorePass: somerandomtext - context: - Environment: - env.first: - name: env.first - value: first.text - type: java.lang.String - override: true - env.second: - name: env.second - value: second.value - type: some.other.type - override: false - Listener: - first: - className: org.apache.catalina.security.SecurityListener - second: - className: org.apache.catalina.core.AprLifecycleListener - SSLEngine: 'on' - Resource: - jdbc: - name: jdbc/__postgres - auth: Container - type: javax.sql.DataSource - driverClassName: org.postgresql.Driver - url: jdbc:postgresql://db.server/dbname - user: dbuser - password: aycaramba! - maxActive: 20 - maxIdle: 10 - maxWait: -1 - ResourceLink: - any_name_here_will_be_ignored: - name: linkToGlobalResource - global: simpleValue - type: java.lang.Integer - expires_when: 2 weeks - group: #{group} - haveged_enabled: true - id: - - example.com - - example.net - java_home: /usr/lib/jvm/default-java - java_opts: - - Djava.awt.headless=true - - Xmx128m - - XX:MaxPermSize=256m - - Dlog4j.configuration=file:/tmp/log4j.properties - - Dlogback.configurationFile=/tmp/logback.xml - jsp_compiler: javac - jvm_tmp: /tmp/tomcat - limit: - hard: 64000 - soft: 64000 - logfile_compress: 1 - logfile_days: 14 - main_config: #{main_config} - main_config_template: salt://tomcat/files/tomcat-default-Debian.template - manager: - roles: - - manager-gui - - manager-script - - manager-jmx - - manager-status - users: - saltuser1: - passwd: RfgpE2iQwD - roles: manager-gui,manager-script,manager-jmx,manager-status - saltuser2: - passwd: RfgpE2iQwD - roles: - - manager-gui - - manager-script - - manager-jmx - - manager-status - manager_pkg: #{manager_pkg} - native_pkg: libtcnative-1 - other_contexts: - other-contexts: - params: - docBase: /path/to/webapp - debug: 1 - reloadable: 'true' - crossContext: 'true' - elements: - Resource: - jdbc: - name: jdbc/__postgres - auth: Container - type: javax.sql.DataSource - driverClassName: org.postgresql.Driver - url: jdbc:postgresql://db.server/dbname - user: dbuser - password: aycaramba! - maxActive: 20 - maxIdle: 10 - maxWait: -1 - Resources: - PostResources: - className: org.apache.catalina.webresources.DirResourceSet - base: /var/lib/tomcat8/appconfig - webAppMount: /WEB-INF/classes - pkg: #{pkg} - resources: {} - security: 'no' - service: #{service} - service_enabled: true - service_running: false - sites: - example.com: - name: tomcat-server - appBase: ../webapps/myapp - path: '' - docBase: ../webapps/myapp - alias: www.example.com - host_parameters: - unpackWARs: 'true' - autoDeploy: 'true' - deployXML: 'false' - reloadable: 'true' - debug: 0 - example.net: - appBase: ../webapps/myapp2 - path: '' - docBase: ../webapps/myapp2 - alias: www.example.net - host_parameters: - unpackWARs: 'true' - autoDeploy: 'true' - reloadable: 'true' - debug: 0 - valves: - - className: org.apache.catalina.valves.AccessLogValve - directory: logs - prefix: localhost_access_log. - fileDateFormat: yyyy-MM-dd-HH - suffix: .log - pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" - "%{User-Agent}i" %D' - - className: org.apache.catalina.authenticator.SingleSignOn - user: #{user} - ver: #{ver} - with_haveged: true - YAML_DUMP - when 'redhat', 'fedora' - case platform[:family] - when 'redhat' - ver = 7 - when 'fedora' - ver = 9 - end - <<~YAML_DUMP.chomp - arch: amd64 - authbind: 'no' - catalina_base: /usr/share/tomcat - catalina_home: /usr/share/tomcat - catalina_pid: /var/run/tomcat.pid - catalina_tmpdir: /var/cache/tomcat/temp - cluster: - simple: true - common_pkg: tomcat-common - conf_dir: /etc/tomcat - connectors: - example_connector: - port: 8443 - protocol: org.apache.coyote.http11.Http11Protocol - connectionTimeout: 20000 - URIEncoding: UTF-8 - redirectPort: 8443 - maxHttpHeaderSize: 8192 - maxThreads: 150 - minSpareThreads: 25 - enableLookups: 'false' - disableUploadTimeout: 'true' - acceptCount: 100 - scheme: https - secure: 'true' - clientAuth: 'false' - sslProtocol: TLS - SSLEnabled: 'false' - keystoreFile: /path/to/keystoreFile - keystorePass: somerandomtext - context: - Environment: - env.first: - name: env.first - value: first.text - type: java.lang.String - override: true - env.second: - name: env.second - value: second.value - type: some.other.type - override: false - Listener: - first: - className: org.apache.catalina.security.SecurityListener - second: - className: org.apache.catalina.core.AprLifecycleListener - SSLEngine: 'on' - Resource: - jdbc: - name: jdbc/__postgres - auth: Container - type: javax.sql.DataSource - driverClassName: org.postgresql.Driver - url: jdbc:postgresql://db.server/dbname - user: dbuser - password: aycaramba! - maxActive: 20 - maxIdle: 10 - maxWait: -1 - ResourceLink: - any_name_here_will_be_ignored: - name: linkToGlobalResource - global: simpleValue - type: java.lang.Integer - expires_when: 2 weeks - group: tomcat - haveged_enabled: false - id: - - example.com - - example.net - java_home: /usr/lib/jvm/jre - java_opts: - - Djava.awt.headless=true - - Xmx128m - - XX:MaxPermSize=256m - - Dlog4j.configuration=file:/tmp/log4j.properties - - Dlogback.configurationFile=/tmp/logback.xml - jsp_compiler: javac - jvm_tmp: /tmp/tomcat - limit: - hard: 64000 - soft: 64000 - logfile_compress: 1 - logfile_days: 14 - main_config: /etc/sysconfig/tomcat - main_config_template: salt://tomcat/files/tomcat-default-CentOS.template - manager: - roles: - - manager-gui - - manager-script - - manager-jmx - - manager-status - users: - saltuser1: - passwd: RfgpE2iQwD - roles: manager-gui,manager-script,manager-jmx,manager-status - saltuser2: - passwd: RfgpE2iQwD - roles: - - manager-gui - - manager-script - - manager-jmx - - manager-status - manager_pkg: tomcat-admin-webapps - native_pkg: tomcat-native - other_contexts: - other-contexts: - params: - docBase: /path/to/webapp - debug: 1 - reloadable: 'true' - crossContext: 'true' - elements: - Resource: - jdbc: - name: jdbc/__postgres - auth: Container - type: javax.sql.DataSource - driverClassName: org.postgresql.Driver - url: jdbc:postgresql://db.server/dbname - user: dbuser - password: aycaramba! - maxActive: 20 - maxIdle: 10 - maxWait: -1 - Resources: - PostResources: - className: org.apache.catalina.webresources.DirResourceSet - base: /var/lib/tomcat8/appconfig - webAppMount: /WEB-INF/classes - pkg: tomcat - resources: {} - security: 'no' - service: tomcat - service_enabled: true - service_running: false - sites: - example.com: - name: tomcat-server - appBase: ../webapps/myapp - path: '' - docBase: ../webapps/myapp - alias: www.example.com - host_parameters: - unpackWARs: 'true' - autoDeploy: 'true' - deployXML: 'false' - reloadable: 'true' - debug: 0 - example.net: - appBase: ../webapps/myapp2 - path: '' - docBase: ../webapps/myapp2 - alias: www.example.net - host_parameters: - unpackWARs: 'true' - autoDeploy: 'true' - reloadable: 'true' - debug: 0 - valves: - - className: org.apache.catalina.valves.AccessLogValve - directory: logs - prefix: localhost_access_log. - fileDateFormat: yyyy-MM-dd-HH - suffix: .log - pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" - "%{User-Agent}i" %D' - - className: org.apache.catalina.authenticator.SingleSignOn - user: tomcat - ver: #{ver} - with_haveged: false - YAML_DUMP - when 'suse' - <<~YAML_DUMP.chomp - arch: amd64 - authbind: 'no' - catalina_base: /usr/share/tomcat - catalina_home: /usr/share/tomcat - catalina_pid: /var/run/tomcat.pid - catalina_tmpdir: /var/cache/tomcat/temp - cluster: - simple: true - common_pkg: tomcat-common - conf_dir: /etc/tomcat - connectors: - example_connector: - port: 8443 - protocol: org.apache.coyote.http11.Http11Protocol - connectionTimeout: 20000 - URIEncoding: UTF-8 - redirectPort: 8443 - maxHttpHeaderSize: 8192 - maxThreads: 150 - minSpareThreads: 25 - enableLookups: 'false' - disableUploadTimeout: 'true' - acceptCount: 100 - scheme: https - secure: 'true' - clientAuth: 'false' - sslProtocol: TLS - SSLEnabled: 'false' - keystoreFile: /path/to/keystoreFile - keystorePass: somerandomtext - context: - Environment: - env.first: - name: env.first - value: first.text - type: java.lang.String - override: true - env.second: - name: env.second - value: second.value - type: some.other.type - override: false - Listener: - first: - className: org.apache.catalina.security.SecurityListener - second: - className: org.apache.catalina.core.AprLifecycleListener - SSLEngine: 'on' - Resource: - jdbc: - name: jdbc/__postgres - auth: Container - type: javax.sql.DataSource - driverClassName: org.postgresql.Driver - url: jdbc:postgresql://db.server/dbname - user: dbuser - password: aycaramba! - maxActive: 20 - maxIdle: 10 - maxWait: -1 - ResourceLink: - any_name_here_will_be_ignored: - name: linkToGlobalResource - global: simpleValue - type: java.lang.Integer - expires_when: 2 weeks - group: tomcat - haveged_enabled: false - id: - - example.com - - example.net - java_home: /usr/lib/jvm/jre - java_opts: - - Djava.awt.headless=true - - Xmx128m - - XX:MaxPermSize=256m - - Dlog4j.configuration=file:/tmp/log4j.properties - - Dlogback.configurationFile=/tmp/logback.xml - jsp_compiler: javac - jvm_tmp: /tmp/tomcat - limit: - hard: 64000 - soft: 64000 - logfile_compress: 1 - logfile_days: 14 - main_config: /etc/sysconfig/tomcat - main_config_template: salt://tomcat/files/tomcat-default-CentOS.template - manager: - roles: - - manager-gui - - manager-script - - manager-jmx - - manager-status - users: - saltuser1: - passwd: RfgpE2iQwD - roles: manager-gui,manager-script,manager-jmx,manager-status - saltuser2: - passwd: RfgpE2iQwD - roles: - - manager-gui - - manager-script - - manager-jmx - - manager-status - manager_pkg: tomcat-admin-webapps - native_pkg: libtcnative-1-0 - other_contexts: - other-contexts: - params: - docBase: /path/to/webapp - debug: 1 - reloadable: 'true' - crossContext: 'true' - elements: - Resource: - jdbc: - name: jdbc/__postgres - auth: Container - type: javax.sql.DataSource - driverClassName: org.postgresql.Driver - url: jdbc:postgresql://db.server/dbname - user: dbuser - password: aycaramba! - maxActive: 20 - maxIdle: 10 - maxWait: -1 - Resources: - PostResources: - className: org.apache.catalina.webresources.DirResourceSet - base: /var/lib/tomcat8/appconfig - webAppMount: /WEB-INF/classes - pkg: tomcat - resources: {} - security: 'no' - service: tomcat - service_enabled: true - service_running: false - sites: - example.com: - name: tomcat-server - appBase: ../webapps/myapp - path: '' - docBase: ../webapps/myapp - alias: www.example.com - host_parameters: - unpackWARs: 'true' - autoDeploy: 'true' - deployXML: 'false' - reloadable: 'true' - debug: 0 - example.net: - appBase: ../webapps/myapp2 - path: '' - docBase: ../webapps/myapp2 - alias: www.example.net - host_parameters: - unpackWARs: 'true' - autoDeploy: 'true' - reloadable: 'true' - debug: 0 - valves: - - className: org.apache.catalina.valves.AccessLogValve - directory: logs - prefix: localhost_access_log. - fileDateFormat: yyyy-MM-dd-HH - suffix: .log - pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" - "%{User-Agent}i" %D' - - className: org.apache.catalina.authenticator.SingleSignOn - user: tomcat - ver: 8 - with_haveged: false - YAML_DUMP - end - - describe file('/tmp/salt_yaml_dump.yaml') do - its('content') { should include yaml_dump } - end -end diff --git a/test/integration/default/files/_mapdata/amazonlinux-1.yaml b/test/integration/default/files/_mapdata/amazonlinux-1.yaml new file mode 100644 index 00000000..5ea3c04f --- /dev/null +++ b/test/integration/default/files/_mapdata/amazonlinux-1.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Amazon Linux AMI-2018 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat + catalina_home: /usr/share/tomcat + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/jre + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/sysconfig/tomcat + main_config_template: salt://tomcat/files/tomcat-default-CentOS.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat-admin-webapps + native_pkg: tomcat-native + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat + resources: {} + security: 'no' + service: tomcat + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 7 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/amazonlinux-2.yaml b/test/integration/default/files/_mapdata/amazonlinux-2.yaml new file mode 100644 index 00000000..b1bc9fa0 --- /dev/null +++ b/test/integration/default/files/_mapdata/amazonlinux-2.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Amazon Linux-2 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat + catalina_home: /usr/share/tomcat + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/jre + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/sysconfig/tomcat + main_config_template: salt://tomcat/files/tomcat-default-CentOS.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat-admin-webapps + native_pkg: tomcat-native + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat + resources: {} + security: 'no' + service: tomcat + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 7 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/arch-base-latest.yaml b/test/integration/default/files/_mapdata/arch-base-latest.yaml new file mode 100644 index 00000000..96e92acb --- /dev/null +++ b/test/integration/default/files/_mapdata/arch-base-latest.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Arch +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat8 + catalina_home: /usr/share/tomcat8 + catalina_pid: /var/run/tomcat8.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat8 + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat8 + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/default-runtime + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /var/tmp/tomcat8/temp + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /usr/lib/systemd/system/tomcat8.service + main_config_template: salt://tomcat/files/tomcat-default-Arch.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: '' + native_pkg: tomcat-native + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat8 + resources: {} + security: 'no' + service: tomcat8 + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat8 + ver: 8 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/centos-6.yaml b/test/integration/default/files/_mapdata/centos-6.yaml new file mode 100644 index 00000000..cfc4da1c --- /dev/null +++ b/test/integration/default/files/_mapdata/centos-6.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# CentOS Linux-7 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat + catalina_home: /usr/share/tomcat + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/jre + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/sysconfig/tomcat + main_config_template: salt://tomcat/files/tomcat-default-CentOS.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat-admin-webapps + native_pkg: tomcat-native + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat + resources: {} + security: 'no' + service: tomcat + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 7 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/centos-7.yaml b/test/integration/default/files/_mapdata/centos-7.yaml new file mode 100644 index 00000000..cfc4da1c --- /dev/null +++ b/test/integration/default/files/_mapdata/centos-7.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# CentOS Linux-7 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat + catalina_home: /usr/share/tomcat + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/jre + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/sysconfig/tomcat + main_config_template: salt://tomcat/files/tomcat-default-CentOS.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat-admin-webapps + native_pkg: tomcat-native + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat + resources: {} + security: 'no' + service: tomcat + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 7 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/centos-8.yaml b/test/integration/default/files/_mapdata/centos-8.yaml new file mode 100644 index 00000000..9e1d4a39 --- /dev/null +++ b/test/integration/default/files/_mapdata/centos-8.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# CentOS Linux-8 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat + catalina_home: /usr/share/tomcat + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/jre + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/sysconfig/tomcat + main_config_template: salt://tomcat/files/tomcat-default-CentOS.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat-admin-webapps + native_pkg: tomcat-native + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat + resources: {} + security: 'no' + service: tomcat + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 7 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/debian-10.yaml b/test/integration/default/files/_mapdata/debian-10.yaml new file mode 100644 index 00000000..7864f273 --- /dev/null +++ b/test/integration/default/files/_mapdata/debian-10.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Debian-10 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /var/lib/tomcat9 + catalina_home: /usr/share/tomcat9 + catalina_pid: /var/run/tomcat9.pid + catalina_tmpdir: /var/cache/tomcat9/temp + cluster: + simple: true + common_pkg: tomcat9-common + conf_dir: /etc/tomcat9 + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: true + id: + - example.com + - example.net + java_home: /usr/lib/jvm/default-java + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/default/tomcat9 + main_config_template: salt://tomcat/files/tomcat-default-Debian.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat9-admin + native_pkg: libtcnative-1 + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat9 + resources: {} + security: 'no' + service: tomcat9 + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 9 + with_haveged: true diff --git a/test/integration/default/files/_mapdata/debian-9.yaml b/test/integration/default/files/_mapdata/debian-9.yaml new file mode 100644 index 00000000..2d8e8165 --- /dev/null +++ b/test/integration/default/files/_mapdata/debian-9.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Debian-9 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /var/lib/tomcat8 + catalina_home: /usr/share/tomcat8 + catalina_pid: /var/run/tomcat8.pid + catalina_tmpdir: /var/cache/tomcat8/temp + cluster: + simple: true + common_pkg: tomcat8-common + conf_dir: /etc/tomcat8 + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat8 + haveged_enabled: true + id: + - example.com + - example.net + java_home: /usr/lib/jvm/default-java + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/default/tomcat8 + main_config_template: salt://tomcat/files/tomcat-default-Debian.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat8-admin + native_pkg: libtcnative-1 + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat8 + resources: {} + security: 'no' + service: tomcat8 + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat8 + ver: 8 + with_haveged: true diff --git a/test/integration/default/files/_mapdata/fedora-31.yaml b/test/integration/default/files/_mapdata/fedora-31.yaml new file mode 100644 index 00000000..9a828b61 --- /dev/null +++ b/test/integration/default/files/_mapdata/fedora-31.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Fedora-31 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat + catalina_home: /usr/share/tomcat + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/jre + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/sysconfig/tomcat + main_config_template: salt://tomcat/files/tomcat-default-CentOS.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat-admin-webapps + native_pkg: tomcat-native + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat + resources: {} + security: 'no' + service: tomcat + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 9 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/fedora-32.yaml b/test/integration/default/files/_mapdata/fedora-32.yaml new file mode 100644 index 00000000..12dbc5ed --- /dev/null +++ b/test/integration/default/files/_mapdata/fedora-32.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Fedora-32 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat + catalina_home: /usr/share/tomcat + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/jre + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/sysconfig/tomcat + main_config_template: salt://tomcat/files/tomcat-default-CentOS.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat-admin-webapps + native_pkg: tomcat-native + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat + resources: {} + security: 'no' + service: tomcat + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 9 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/opensuse-15.yaml b/test/integration/default/files/_mapdata/opensuse-15.yaml new file mode 100644 index 00000000..a64a056f --- /dev/null +++ b/test/integration/default/files/_mapdata/opensuse-15.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Leap-15 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /usr/share/tomcat + catalina_home: /usr/share/tomcat + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat-common + conf_dir: /etc/tomcat + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: false + id: + - example.com + - example.net + java_home: /usr/lib/jvm/jre + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/sysconfig/tomcat + main_config_template: salt://tomcat/files/tomcat-default-CentOS.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat-admin-webapps + native_pkg: libtcnative-1-0 + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat + resources: {} + security: 'no' + service: tomcat + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 8 + with_haveged: false diff --git a/test/integration/default/files/_mapdata/ubuntu-16.yaml b/test/integration/default/files/_mapdata/ubuntu-16.yaml new file mode 100644 index 00000000..1ecf5b96 --- /dev/null +++ b/test/integration/default/files/_mapdata/ubuntu-16.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Ubuntu-16.04 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /var/lib/tomcat9 + catalina_home: /usr/share/tomcat9 + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat9-common + conf_dir: /etc/tomcat9 + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: true + id: + - example.com + - example.net + java_home: /usr/lib/jvm/default-java + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/default/tomcat9 + main_config_template: salt://tomcat/files/tomcat-default-Debian.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat9-admin + native_pkg: libtcnative-1 + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat9 + resources: {} + security: 'no' + service: tomcat9 + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 9 + with_haveged: true diff --git a/test/integration/default/files/_mapdata/ubuntu-18.yaml b/test/integration/default/files/_mapdata/ubuntu-18.yaml new file mode 100644 index 00000000..1fe3981c --- /dev/null +++ b/test/integration/default/files/_mapdata/ubuntu-18.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Ubuntu-18.04 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /var/lib/tomcat9 + catalina_home: /usr/share/tomcat9 + catalina_pid: /var/run/tomcat.pid + catalina_tmpdir: /var/cache/tomcat/temp + cluster: + simple: true + common_pkg: tomcat9-common + conf_dir: /etc/tomcat9 + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: true + id: + - example.com + - example.net + java_home: /usr/lib/jvm/default-java + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/default/tomcat9 + main_config_template: salt://tomcat/files/tomcat-default-Debian.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat9-admin + native_pkg: libtcnative-1 + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat9 + resources: {} + security: 'no' + service: tomcat9 + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 9 + with_haveged: true diff --git a/test/integration/default/files/_mapdata/ubuntu-20.yaml b/test/integration/default/files/_mapdata/ubuntu-20.yaml new file mode 100644 index 00000000..c48fed78 --- /dev/null +++ b/test/integration/default/files/_mapdata/ubuntu-20.yaml @@ -0,0 +1,177 @@ +# yamllint disable rule:indentation rule:line-length +# Ubuntu-20.04 +--- +values: + tomcat: + arch: amd64 + authbind: 'no' + catalina_base: /var/lib/tomcat9 + catalina_home: /usr/share/tomcat9 + catalina_pid: /var/run/tomcat9.pid + catalina_tmpdir: /var/cache/tomcat9/temp + cluster: + simple: true + common_pkg: tomcat9-common + conf_dir: /etc/tomcat9 + connectors: + example_connector: + SSLEnabled: 'false' + URIEncoding: UTF-8 + acceptCount: 100 + clientAuth: 'false' + connectionTimeout: 20000 + disableUploadTimeout: 'true' + enableLookups: 'false' + keystoreFile: /path/to/keystoreFile + keystorePass: somerandomtext + maxHttpHeaderSize: 8192 + maxThreads: 150 + minSpareThreads: 25 + port: 8443 + protocol: org.apache.coyote.http11.Http11Protocol + redirectPort: 8443 + scheme: https + secure: 'true' + sslProtocol: TLS + context: + Environment: + env.first: + name: env.first + override: true + type: java.lang.String + value: first.text + env.second: + name: env.second + override: false + type: some.other.type + value: second.value + Listener: + first: + className: org.apache.catalina.security.SecurityListener + second: + SSLEngine: 'on' + className: org.apache.catalina.core.AprLifecycleListener + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + ResourceLink: + any_name_here_will_be_ignored: + global: simpleValue + name: linkToGlobalResource + type: java.lang.Integer + expires_when: 2 weeks + group: tomcat + haveged_enabled: true + id: + - example.com + - example.net + java_home: /usr/lib/jvm/default-java + java_opts: + - Djava.awt.headless=true + - Xmx128m + - XX:MaxPermSize=256m + - Dlog4j.configuration=file:/tmp/log4j.properties + - Dlogback.configurationFile=/tmp/logback.xml + jsp_compiler: javac + jvm_tmp: /tmp/tomcat + limit: + hard: 64000 + soft: 64000 + logfile_compress: 1 + logfile_days: 14 + main_config: /etc/default/tomcat9 + main_config_template: salt://tomcat/files/tomcat-default-Debian.template + manager: + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + users: + saltuser1: + passwd: RfgpE2iQwD + roles: manager-gui,manager-script,manager-jmx,manager-status + saltuser2: + passwd: RfgpE2iQwD + roles: + - manager-gui + - manager-script + - manager-jmx + - manager-status + manager_pkg: tomcat9-admin + native_pkg: libtcnative-1 + other_contexts: + other-contexts: + elements: + Resource: + jdbc: + auth: Container + driverClassName: org.postgresql.Driver + maxActive: 20 + maxIdle: 10 + maxWait: -1 + name: jdbc/__postgres + password: aycaramba! + type: javax.sql.DataSource + url: jdbc:postgresql://db.server/dbname + user: dbuser + Resources: + PostResources: + base: /var/lib/tomcat8/appconfig + className: org.apache.catalina.webresources.DirResourceSet + webAppMount: /WEB-INF/classes + params: + crossContext: 'true' + debug: 1 + docBase: /path/to/webapp + reloadable: 'true' + pkg: tomcat9 + resources: {} + security: 'no' + service: tomcat9 + service_enabled: true + service_running: false + sites: + example.com: + alias: www.example.com + appBase: ../webapps/myapp + debug: 0 + docBase: ../webapps/myapp + host_parameters: + autoDeploy: 'true' + deployXML: 'false' + unpackWARs: 'true' + name: tomcat-server + path: '' + reloadable: 'true' + example.net: + alias: www.example.net + appBase: ../webapps/myapp2 + debug: 0 + docBase: ../webapps/myapp2 + host_parameters: + autoDeploy: 'true' + unpackWARs: 'true' + path: '' + reloadable: 'true' + valves: + - className: org.apache.catalina.valves.AccessLogValve + directory: logs + fileDateFormat: yyyy-MM-dd-HH + pattern: '%h %l %u %t "%m http://%v%U %H" %s %b "%{Referer}i" + "%{User-Agent}i" %D' + prefix: localhost_access_log. + suffix: .log + - className: org.apache.catalina.authenticator.SingleSignOn + user: tomcat + ver: 9 + with_haveged: true diff --git a/test/salt/comparison_files/main_config/amazon-2 b/test/integration/default/files/main_config/amazonlinux-2 similarity index 100% rename from test/salt/comparison_files/main_config/amazon-2 rename to test/integration/default/files/main_config/amazonlinux-2 diff --git a/test/salt/comparison_files/main_config/centos-7 b/test/integration/default/files/main_config/centos-7 similarity index 100% rename from test/salt/comparison_files/main_config/centos-7 rename to test/integration/default/files/main_config/centos-7 diff --git a/test/salt/comparison_files/main_config/debian-10 b/test/integration/default/files/main_config/debian-10 similarity index 100% rename from test/salt/comparison_files/main_config/debian-10 rename to test/integration/default/files/main_config/debian-10 diff --git a/test/salt/comparison_files/main_config/debian-8 b/test/integration/default/files/main_config/debian-8 similarity index 100% rename from test/salt/comparison_files/main_config/debian-8 rename to test/integration/default/files/main_config/debian-8 diff --git a/test/salt/comparison_files/main_config/debian-9 b/test/integration/default/files/main_config/debian-9 similarity index 100% rename from test/salt/comparison_files/main_config/debian-9 rename to test/integration/default/files/main_config/debian-9 diff --git a/test/salt/comparison_files/main_config/fedora-31 b/test/integration/default/files/main_config/fedora-31 similarity index 100% rename from test/salt/comparison_files/main_config/fedora-31 rename to test/integration/default/files/main_config/fedora-31 diff --git a/test/salt/comparison_files/main_config/fedora-32 b/test/integration/default/files/main_config/fedora-32 similarity index 100% rename from test/salt/comparison_files/main_config/fedora-32 rename to test/integration/default/files/main_config/fedora-32 diff --git a/test/salt/comparison_files/main_config/opensuse-15 b/test/integration/default/files/main_config/opensuse-15 similarity index 100% rename from test/salt/comparison_files/main_config/opensuse-15 rename to test/integration/default/files/main_config/opensuse-15 diff --git a/test/salt/comparison_files/main_config/ubuntu-16 b/test/integration/default/files/main_config/ubuntu-16 similarity index 100% rename from test/salt/comparison_files/main_config/ubuntu-16 rename to test/integration/default/files/main_config/ubuntu-16 diff --git a/test/salt/comparison_files/main_config/ubuntu-18 b/test/integration/default/files/main_config/ubuntu-18 similarity index 100% rename from test/salt/comparison_files/main_config/ubuntu-18 rename to test/integration/default/files/main_config/ubuntu-18 diff --git a/test/salt/comparison_files/main_config/ubuntu-20 b/test/integration/default/files/main_config/ubuntu-20 similarity index 100% rename from test/salt/comparison_files/main_config/ubuntu-20 rename to test/integration/default/files/main_config/ubuntu-20 diff --git a/test/salt/comparison_files/server_xml/amazon-2.xml b/test/integration/default/files/server_xml/amazonlinux-2.xml similarity index 98% rename from test/salt/comparison_files/server_xml/amazon-2.xml rename to test/integration/default/files/server_xml/amazonlinux-2.xml index fd7be24f..42930779 100644 --- a/test/salt/comparison_files/server_xml/amazon-2.xml +++ b/test/integration/default/files/server_xml/amazonlinux-2.xml @@ -92,7 +92,7 @@ /> - + diff --git a/test/salt/comparison_files/server_xml/centos-7.xml b/test/integration/default/files/server_xml/centos-7.xml similarity index 98% rename from test/salt/comparison_files/server_xml/centos-7.xml rename to test/integration/default/files/server_xml/centos-7.xml index fd7be24f..42930779 100644 --- a/test/salt/comparison_files/server_xml/centos-7.xml +++ b/test/integration/default/files/server_xml/centos-7.xml @@ -92,7 +92,7 @@ /> - + diff --git a/test/salt/comparison_files/server_xml/debian-10.xml b/test/integration/default/files/server_xml/debian-10.xml similarity index 100% rename from test/salt/comparison_files/server_xml/debian-10.xml rename to test/integration/default/files/server_xml/debian-10.xml diff --git a/test/salt/comparison_files/server_xml/debian-8.xml b/test/integration/default/files/server_xml/debian-8.xml similarity index 98% rename from test/salt/comparison_files/server_xml/debian-8.xml rename to test/integration/default/files/server_xml/debian-8.xml index 2e673704..36e80a1b 100644 --- a/test/salt/comparison_files/server_xml/debian-8.xml +++ b/test/integration/default/files/server_xml/debian-8.xml @@ -92,7 +92,7 @@ /> - + diff --git a/test/salt/comparison_files/server_xml/debian-9.xml b/test/integration/default/files/server_xml/debian-9.xml similarity index 100% rename from test/salt/comparison_files/server_xml/debian-9.xml rename to test/integration/default/files/server_xml/debian-9.xml diff --git a/test/salt/comparison_files/server_xml/fedora-31.xml b/test/integration/default/files/server_xml/fedora-31.xml similarity index 100% rename from test/salt/comparison_files/server_xml/fedora-31.xml rename to test/integration/default/files/server_xml/fedora-31.xml diff --git a/test/salt/comparison_files/server_xml/fedora-32.xml b/test/integration/default/files/server_xml/fedora-32.xml similarity index 100% rename from test/salt/comparison_files/server_xml/fedora-32.xml rename to test/integration/default/files/server_xml/fedora-32.xml diff --git a/test/salt/comparison_files/server_xml/opensuse-15.xml b/test/integration/default/files/server_xml/opensuse-15.xml similarity index 100% rename from test/salt/comparison_files/server_xml/opensuse-15.xml rename to test/integration/default/files/server_xml/opensuse-15.xml diff --git a/test/salt/comparison_files/server_xml/ubuntu-16.xml b/test/integration/default/files/server_xml/ubuntu-16.xml similarity index 100% rename from test/salt/comparison_files/server_xml/ubuntu-16.xml rename to test/integration/default/files/server_xml/ubuntu-16.xml diff --git a/test/salt/comparison_files/server_xml/ubuntu-18.xml b/test/integration/default/files/server_xml/ubuntu-18.xml similarity index 100% rename from test/salt/comparison_files/server_xml/ubuntu-18.xml rename to test/integration/default/files/server_xml/ubuntu-18.xml diff --git a/test/salt/comparison_files/server_xml/ubuntu-20.xml b/test/integration/default/files/server_xml/ubuntu-20.xml similarity index 100% rename from test/salt/comparison_files/server_xml/ubuntu-20.xml rename to test/integration/default/files/server_xml/ubuntu-20.xml diff --git a/test/integration/default/inspec.yml b/test/integration/default/inspec.yml index efbfb006..be330e7f 100644 --- a/test/integration/default/inspec.yml +++ b/test/integration/default/inspec.yml @@ -6,6 +6,9 @@ title: tomcat formula maintainer: SaltStack Formulas license: Apache-2.0 summary: Verify that the tomcat formula is setup and configured correctly +depends: + - name: share + path: test/integration/share supports: - platform-name: debian - platform-name: ubuntu diff --git a/test/integration/share/README.md b/test/integration/share/README.md new file mode 100644 index 00000000..5bc510cd --- /dev/null +++ b/test/integration/share/README.md @@ -0,0 +1,21 @@ +# InSpec Profile: `share` + +This shows the implementation of the `share` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). + +Its goal is to share the libraries between all profiles. + +## Libraries + +### `system` + +The `system` library provides easy access to system dependent information: + +- `system.platform`: based on `inspec.platform`, modify to values that are more consistent from a SaltStack perspective + - `system.platform[:family]` provide a family name for Arch and Gentoo + - `system.platform[:name]` append `linux` to both `amazon` and `oracle`; ensure Windows platforms are resolved as simply `windows` + - `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo and Windows: + - `Arch` is always `base-latest` + - `Amazon Linux` release `2018` is resolved as `1` + - `Gentoo` release is trimmed to its major version number and then the init system is appended (i.e. `sysv` or `sysd`) + - `Windows` uses the widely-used release number (e.g. `8.1` or `2019-server`) in place of the actual system release version + - `system.platform[:finger]` is the concatenation of the name and the major release number (except for Ubuntu, which gives `ubuntu-20.04` for example) diff --git a/test/integration/share/inspec.yml b/test/integration/share/inspec.yml new file mode 100644 index 00000000..697417a1 --- /dev/null +++ b/test/integration/share/inspec.yml @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: share +title: InSpec shared resources +maintainer: SaltStack Formulas +license: Apache-2.0 +summary: shared resources +supports: + - platform-name: debian + - platform-name: ubuntu + - platform-name: centos + - platform-name: fedora + - platform-name: opensuse + - platform-name: suse + - platform-name: freebsd + - platform-name: amazon + - platform-name: oracle + - platform-name: arch + - platform-name: gentoo + - platform: windows diff --git a/test/integration/share/libraries/system.rb b/test/integration/share/libraries/system.rb new file mode 100644 index 00000000..ef234996 --- /dev/null +++ b/test/integration/share/libraries/system.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +# system.rb -- InSpec resources for system values +# Author: Daniel Dehennin +# Copyright (C) 2020 Daniel Dehennin + +class SystemResource < Inspec.resource(1) + name 'system' + + attr_reader :platform + + def initialize + super + @platform = build_platform + end + + private + + def build_platform + { + family: build_platform_family, + name: build_platform_name, + release: build_platform_release, + finger: build_platform_finger + } + end + + def build_platform_family + case inspec.platform[:name] + when 'arch', 'gentoo' + inspec.platform[:name] + else + inspec.platform[:family] + end + end + + def build_platform_name + case inspec.platform[:name] + when 'amazon', 'oracle' + "#{inspec.platform[:name]}linux" + when 'windows_8.1_pro', 'windows_server_2019_datacenter' + 'windows' + else + inspec.platform[:name] + end + end + + # rubocop:disable Metrics/MethodLength + def build_platform_release + case inspec.platform[:name] + when 'amazon' + # `2018` relase is named `1` in kitchen.yaml + inspec.platform[:release].gsub(/2018.*/, '1') + when 'arch' + 'base-latest' + when 'gentoo' + "#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}" + when 'windows_8.1_pro' + '8.1' + when 'windows_server_2019_datacenter' + '2019-server' + else + inspec.platform[:release] + end + end + # rubocop:enable Metrics/MethodLength + + def derive_gentoo_init_system + case inspec.command('systemctl').exist? + when true + 'sysd' + else + 'sysv' + end + end + + def build_platform_finger + "#{build_platform_name}-#{build_finger_release}" + end + + def build_finger_release + case inspec.platform[:name] + when 'ubuntu' + build_platform_release.split('.').slice(0, 2).join('.') + else + build_platform_release.split('.')[0] + end + end +end diff --git a/tomcat/_mapdata/_mapdata.jinja b/tomcat/_mapdata/_mapdata.jinja new file mode 100644 index 00000000..aa9649cf --- /dev/null +++ b/tomcat/_mapdata/_mapdata.jinja @@ -0,0 +1,13 @@ +# yamllint disable rule:indentation rule:line-length +# {{ grains.get("osfinger", grains.os) }} +--- +{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #} +{{ salt["slsutil.serialize"]( + "yaml", + map, + default_flow_style=False, + allow_unicode=True, + ) + | regex_replace("^\s+'$", "'", multiline=True) + | trim +}} diff --git a/tomcat/_mapdata/init.sls b/tomcat/_mapdata/init.sls new file mode 100644 index 00000000..2cff3f52 --- /dev/null +++ b/tomcat/_mapdata/init.sls @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split("/")[0] %} +{%- from tplroot ~ "/map.jinja" import tomcat with context %} + +{%- set _mapdata = { + "values": { + "tomcat": tomcat, + } + } %} +{%- do salt["log.debug"]("### MAP.JINJA DUMP ###\n" ~ _mapdata | yaml(False)) %} + +{%- set output_dir = "/temp" if grains.os_family == "Windows" else "/tmp" %} +{%- set output_file = output_dir ~ "/salt_mapdata_dump.yaml" %} + +{{ tplroot }}-mapdata-dump: + file.managed: + - name: {{ output_file }} + - source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja + - template: jinja + - context: + map: {{ _mapdata | yaml }} diff --git a/tomcat/yaml_dump/init.sls b/tomcat/yaml_dump/init.sls deleted file mode 100644 index 6a088011..00000000 --- a/tomcat/yaml_dump/init.sls +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls ---- -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import tomcat as map with context %} - -{%- set output_file = '/tmp/salt_yaml_dump.yaml' %} - -yaml-dump-{{ tplroot }}: - file.managed: - - name: {{ output_file }} - - source: salt://{{ tplroot }}/yaml_dump/yaml_dump.jinja - - template: jinja - - context: - map: {{ map | yaml }} diff --git a/tomcat/yaml_dump/yaml_dump.jinja b/tomcat/yaml_dump/yaml_dump.jinja deleted file mode 100644 index 300b464e..00000000 --- a/tomcat/yaml_dump/yaml_dump.jinja +++ /dev/null @@ -1,4 +0,0 @@ -# yamllint disable rule:indentation rule:line-length -# {{ grains.get('osfinger', grains.os) }}-{{ grains.saltversion }}-py{{ grains.pythonversion[0] }} ---- -{{ map|yaml(False)|trim }}