Skip to content

Commit

Permalink
Merge pull request ansible-middleware#217 from ansible-middleware/ski…
Browse files Browse the repository at this point in the history
…p_pidfile_validation

Skip pidfile validation
  • Loading branch information
guidograzioli authored Apr 8, 2024
2 parents 1062852 + 8823cca commit b931b08
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
7 changes: 7 additions & 0 deletions roles/wildfly_validation/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@
- wildfly_service_name
- not wildfly_validation_skip_systemd_check is defined

- name: "Verify pidfile used by the service."
ansible.builtin.include_tasks: pidfile_validate.yml
when:
- wildfly_systemd_unit_enabled is defined and wildfly_systemd_unit_enabled
- wildfly_service_name
- not wildfly_validation_skip_systemd_check is defined

- name: "Verify server's internal configuration"
ansible.builtin.include_tasks: verify_with_cli_queries.yml
vars:
Expand Down
18 changes: 8 additions & 10 deletions roles/wildfly_validation/tasks/pidfile_validate.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
---
- name: "Check if {{ wildfly_instance_name }} service is running"
ansible.builtin.systemd:
name: "{{ wildfly_instance_name }}"
register: service_status

- name: "Get {{ wildfly_instance_name }} process ID"
ansible.builtin.command: "pgrep -f {{ wildfly_instance_name }}"
register: wildfly_pid
ignore_errors: yes
when: service_status.status.ActiveState == "active"
- name: "Verify that PID file has been created."
ansible.builtin.assert:
that:
- wildfly_validation_systemd_pidfile is exists
quiet: true
fail_msg: "PID file {{ wildfly_validation_systemd_pidfile }} has not been created."
when:
- wildfly_validation_systemd_pidfile is defined and wildfly_validation_systemd_pidfile | length > 0

- name: "Read content of the PID file"
ansible.builtin.slurp:
Expand Down
9 changes: 0 additions & 9 deletions roles/wildfly_validation/tasks/systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,3 @@
fail_msg: "Systemd service {{ wildfly_service_name }} is not the expected state."
when:
- wildfly_service_name is defined

- name: "Verify that PID file has been created."
ansible.builtin.assert:
that:
- wildfly_validation_systemd_pidfile is exists
quiet: true
fail_msg: "PID file {{ wildfly_validation_systemd_pidfile }} has not been created."
when:
- wildfly_validation_systemd_pidfile is defined

0 comments on commit b931b08

Please sign in to comment.