-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
# test this scenario from the roles/tomcat directory with the command | ||
# molecule --base-config ../../molecule_configs/centos7_base_config.yml test --scenario centos7 | ||
platforms: | ||
- name: tomcat9_server | ||
hostname: molecule.tomcat9.local | ||
image: ${MOLECULE_DOCKER_IMAGE:-geerlingguy/docker-centos7-ansible:latest} | ||
required: true | ||
command: "" | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: ${MOLECULE_PRE_BUILD_IMAGE:-true} | ||
volumes: | ||
- ./tomcat9-data:/storage/molecule/tomcat9 | ||
keep_volumes: false | ||
groups: | ||
- all | ||
- molecule | ||
- centos7 | ||
- tomcat9 | ||
docker_networks: | ||
- name: molecule | ||
ipam_config: | ||
- subnet: 192.168.56.0/24 | ||
gateway: 192.168.56.1 | ||
networks: | ||
- name: molecule | ||
ipv4_address: 192.168.56.2 | ||
|
||
- name: tomcat10_server | ||
hostname: molecule.tomcat10.local | ||
image: ${MOLECULE_DOCKER_IMAGE:-geerlingguy/docker-centos7-ansible:latest} | ||
required: true | ||
command: "" | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: ${MOLECULE_PRE_BUILD_IMAGE:-true} | ||
volumes: | ||
- ./tomcat10-data:/storage/molecule/tomcat10 | ||
keep_volumes: false | ||
groups: | ||
- all | ||
- molecule | ||
- centos7 | ||
- tomcat10 | ||
docker_networks: | ||
- name: molecule | ||
ipam_config: | ||
- subnet: 192.168.56.0/24 | ||
gateway: 192.168.56.1 | ||
networks: | ||
- name: molecule | ||
ipv4_address: 192.168.56.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Install Tomcat | ||
hosts: all | ||
become: true | ||
gather_facts: true | ||
roles: | ||
- role: mirsg.infrastructure.tomcat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
2 changes: 2 additions & 0 deletions
2
roles/tomcat/molecule/resources/inventory/group_vars/tomcat10.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
tomcat_version: 10.1.19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Prepare - install sudo and Java | ||
hosts: all | ||
gather_facts: true | ||
pre_tasks: | ||
- name: Install sudo | ||
ansible.builtin.package: | ||
name: sudo | ||
state: present | ||
roles: | ||
- role: mirsg.infrastructure.install_java | ||
java_package: "{{ 'java-11-openjdk' if 'tomcat10' in group_names else 'java-1.8.0-openjdk'}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
- name: Verify correct tomcat version is installed and running | ||
hosts: all | ||
tasks: | ||
- name: Get status of all services | ||
ansible.builtin.service_facts: | ||
|
||
- name: Check tomcat is enabled and running | ||
ansible.builtin.assert: | ||
that: | ||
- ansible_facts.services["tomcat.service"].state == "running" | ||
- ansible_facts.services["tomcat.service"].status == "enabled" | ||
|
||
- name: Check installed Tomcat version | ||
ansible.builtin.shell: | | ||
set -o pipefail | ||
./version.sh | grep -oP '(?<=Apache Tomcat/)([0-9]+\.?)+' | ||
args: | ||
chdir: "/usr/share/tomcat/bin" | ||
register: tomcat_check_version | ||
|
||
- name: Print version | ||
ansible.builtin.debug: | ||
var: tomcat_check_version.stdout | ||
|
||
- name: Check Tomcat version is correct | ||
ansible.builtin.assert: | ||
that: | ||
- tomcat_check_version.stdout.split(".")[0] is version(expected_version) | ||
vars: | ||
expected_version: "{{ '10' if 'tomcat10' in group_names else '9' }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
# test this scenario from the roles/tomcat directory with the command | ||
# molecule --base-config ../../molecule_configs/rocky9_base_config.yml test --scenario rocky9 | ||
platforms: | ||
- name: tomcat9_server | ||
hostname: molecule.tomcat9.local | ||
image: rockylinux/rockylinux:9-ubi-init | ||
required: true | ||
command: "" | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: ${MOLECULE_PRE_BUILD_IMAGE:-true} | ||
volumes: | ||
- ./tomcat9-data:/storage/molecule/tomcat9 | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
keep_volumes: false | ||
groups: | ||
- all | ||
- molecule | ||
- rocky9 | ||
- tomcat9 | ||
docker_networks: | ||
- name: molecule | ||
ipam_config: | ||
- subnet: 192.168.56.0/24 | ||
gateway: 192.168.56.1 | ||
networks: | ||
- name: molecule | ||
ipv4_address: 192.168.56.2 | ||
|
||
- name: tomcat10_server | ||
hostname: molecule.tomcat10.local | ||
image: rockylinux/rockylinux:9-ubi-init | ||
required: true | ||
command: "" | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: ${MOLECULE_PRE_BUILD_IMAGE:-true} | ||
volumes: | ||
- ./tomcat10-data:/storage/molecule/tomcat10 | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
keep_volumes: false | ||
groups: | ||
- all | ||
- molecule | ||
- rocky9 | ||
- tomcat10 | ||
networks: | ||
- name: molecule | ||
ipv4_address: 192.168.56.3 |