Skip to content

Commit

Permalink
use flatten variables
Browse files Browse the repository at this point in the history
  • Loading branch information
zhan9san committed Oct 26, 2024
1 parent da8de5d commit 627111b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,29 @@
- name: Verify Jenkins systemd unit environment variables
hosts: all
tasks:
- name: Assert JAVA_OPTS is defined in override.conf
- name: Read override.conf content
ansible.builtin.slurp:
src: /etc/systemd/system/jenkins.service.d/override.conf # Adjust the path as necessary
src: /etc/systemd/system/jenkins.service.d/override.conf
register: override_conf_content

- name: Decode override.conf content
ansible.builtin.set_fact:
override_conf_decoded: "{{ override_conf_content.content | b64decode }}"

- name: Print decoded override.conf content
ansible.builtin.debug:
var: override_conf_decoded

- name: Assert JAVA_OPTS is present
ansible.builtin.assert:
that:
- override_conf_decoded is defined
- override_conf_decoded | search('JAVA_OPTS=-Djenkins.install.runSetupWizard=false')
- 'JAVA_OPTS=-Djenkins.install.runSetupWizard=false' in override_conf_decoded
fail_msg: "JAVA_OPTS is not set correctly in override.conf."

- name: Assert JENKINS_LISTEN_ADDRESS is present
ansible.builtin.assert:
that:
- override_conf_decoded is defined
- override_conf_decoded | search('JENKINS_LISTEN_ADDRESS=127.0.0.1')
- 'JENKINS_LISTEN_ADDRESS=127.0.0.1' in override_conf_decoded
fail_msg: "JENKINS_LISTEN_ADDRESS is not set correctly in override.conf."

0 comments on commit 627111b

Please sign in to comment.