Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
fqcn: 'middleware_automation/wildfly'
root_permission_varname: 'wildfly_install_requires_become'
molecule_tests: >-
[ "default", "prospero", "yaml_config_validation", "install_options", "colocated_cluster", "custom_config_file", "temurinjdk_support", "app_deploy_standalone", "wildfly_migration", "uninstall" ]
[ "default", "prospero", "yaml_config_validation", "install_options", "install_systemd_jdk", "colocated_cluster", "custom_config_file", "temurinjdk_support", "app_deploy_standalone", "wildfly_migration", "uninstall" ]
8 changes: 8 additions & 0 deletions molecule/install_systemd_jdk/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- import_playbook: ../../playbooks/playbook.yml
vars:
wildfly_java_version: 17
wildfly_java_package_name: "java-17-openjdk-headless"
wildfly_validation_debug: True
wildfly_systemd_wait_for_timeout: 120
wildfly_systemd_wait_for_delay: 5
48 changes: 48 additions & 0 deletions molecule/install_systemd_jdk/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
provisioner:
name: ansible
config_options:
defaults:
interpreter_python: auto_silent
bin_ansible_callbacks: true
callbacks_enabled: junit
ssh_connection:
pipelining: false
playbooks:
prepare: ../prepare.yml
converge: converge.yml
verify: verify.yml
inventory:
links:
group_vars: ../group_vars
group_vars:
all:
molecule_scenario_requires_app: true
env:
JUNIT_OUTPUT_DIR: "$PWD/junit"
JUNIT_HIDE_TASK_ARGUMENTS: yes
JUNIT_TASK_RELATIVE_PATH: "$PWD"
JUNIT_TASK_CLASS: "true"
JUNIT_REPLACE_OUT_OF_TREE_PATH: ""
ANSIBLE_FORCE_COLOR: "true"
ANSIBLE_COLLECTIONS_PATHS: "~/.ansible/collections/"
ANSIBLE_ROLES_PATH: "../../roles"

verifier:
name: ansible
options:
sudo: true

scenario:
test_sequence:
- cleanup
- destroy
- syntax
- create
- prepare
- converge
- idempotence
- side_effect
- verify
- cleanup
- destroy
2 changes: 2 additions & 0 deletions molecule/install_systemd_jdk/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
wildfly_java_version: 17
wildfly_validation_debug: True
9 changes: 9 additions & 0 deletions molecule/install_systemd_jdk/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Verify jdk installation
hosts: all
vars_files:
- vars.yml
- ../group_vars/all/vars.yml
tasks:
- name: "Verify that state is consistent"
ansible.builtin.include_tasks: ../verify_jdk_scenario.yml
41 changes: 41 additions & 0 deletions molecule/verify_jdk_scenario.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
- name: "Ensure required parameters are provided."
ansible.builtin.assert:
that:
- wildfly_java_version is defined
quiet: true

- name: "Verify that state is consistent"
ansible.builtin.import_role:
name: wildfly_validation

- name: "Verify WildFly log contains correct Java"
become: "{{ wildfly_install_requires_become | default(true) }}"
block:
- ansible.builtin.shell:
cmd: cat {{ wildfly_validation_logfile_path_to_logfile }}
become: "{{ wildfly_install_requires_become | default(true) }}"
changed_when: False
register: command_output

- ansible.builtin.set_fact:
java_from_log: "{{ command_output.stdout | regex_search('^\\s*java.home\\s*=.*$', multiline=True) }}"

- name: "Compute regex search rule"
ansible.builtin.set_fact:
regex_pattern: "^\\s*java.home\\s*=\\s*.*/java-{{ wildfly_java_version }}-openjdk.*$"

- ansible.builtin.set_fact:
expected_java_from_log: "{{ java_from_log | regex_search(regex_pattern, multiline=True) }}"
- ansible.builtin.debug:
var: java_from_log
when:
- wildfly_validation_debug is defined
- ansible.builtin.debug:
var: expected_java_from_log
when:
- wildfly_validation_debug is defined
- ansible.builtin.assert:
that:
- expected_java_from_log is defined
- expected_java_from_log != ''
Loading