-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sap_hana_preconfigure: fix wrong variable substitution inside assert-…
…services.yml Signed-off-by: Bernd Finger <[email protected]>
- Loading branch information
1 parent
5afc8c3
commit e3e3073
Showing
6 changed files
with
65 additions
and
38 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
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
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
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
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
58 changes: 25 additions & 33 deletions
58
roles/sap_hana_preconfigure/tasks/RedHat/generic/assert-services.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 |
---|---|---|
@@ -1,46 +1,38 @@ | ||
--- | ||
|
||
- name: Assert that service {{ __sap_hana_preconfigure_packages_and_services[line_item].svc }} is disabled | ||
if package {{ __sap_hana_preconfigure_packages_and_services[line_item].pkg }} is installed | ||
when: "__sap_hana_preconfigure_packages_and_services[line_item].pkg in ansible_facts.packages" | ||
- name: Assert that service {{ __sap_hana_preconfigure_packages_and_services_svc }} is disabled | ||
if package {{ __sap_hana_preconfigure_packages_and_services_pkg }} is installed | ||
when: "__sap_hana_preconfigure_packages_and_services_pkg in ansible_facts.packages" | ||
block: | ||
|
||
- name: "Report that package {{ __sap_hana_preconfigure_packages_and_services[line_item].pkg }} is installed" | ||
- name: "Report that package {{ __sap_hana_preconfigure_packages_and_services_pkg }} is installed" | ||
ansible.builtin.debug: | ||
msg: "INFO: Package '{{ __sap_hana_preconfigure_packages_and_services[line_item].pkg }}' is installed." | ||
msg: "INFO: Package '{{ __sap_hana_preconfigure_packages_and_services_pkg }}' is installed." | ||
|
||
- name: Define a new variable for the assertion of the service status | ||
ansible.builtin.set_fact: | ||
__sap_hana_preconfigure_service_item_status: ansible_facts.services['{{ __sap_hana_preconfigure_packages_and_services[line_item].svc }}.service'].status | ||
|
||
- name: Assert that service {{ __sap_hana_preconfigure_packages_and_services[line_item].svc }} is | ||
{{ __sap_hana_preconfigure_packages_and_services[line_item].svc_status }} | ||
- name: Assert that service {{ __sap_hana_preconfigure_packages_and_services_svc }} is | ||
{{ __sap_hana_preconfigure_packages_and_services_svc_status }} | ||
ansible.builtin.assert: | ||
that: __sap_hana_preconfigure_service_item_status == __sap_hana_preconfigure_packages_and_services[line_item].svc_status | ||
fail_msg: "FAIL: Service '{{ __sap_hana_preconfigure_packages_and_services[line_item].svc }}' is not | ||
{{ __sap_hana_preconfigure_packages_and_services[line_item].svc_status }}!" | ||
success_msg: "PASS: Service '{{ __sap_hana_preconfigure_packages_and_services[line_item].svc }}' is | ||
{{ __sap_hana_preconfigure_packages_and_services[line_item].svc_status }}." | ||
that: __sap_hana_preconfigure_service_status == __sap_hana_preconfigure_packages_and_services_svc_status | ||
fail_msg: "FAIL: Service '{{ __sap_hana_preconfigure_packages_and_services_svc }}' is not | ||
{{ __sap_hana_preconfigure_packages_and_services_svc_status }}!" | ||
success_msg: "PASS: Service '{{ __sap_hana_preconfigure_packages_and_services_svc }}' is | ||
{{ __sap_hana_preconfigure_packages_and_services_svc_status }}." | ||
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}" | ||
|
||
- name: Define a new variable for the assertion of the service state | ||
ansible.builtin.set_fact: | ||
__sap_hana_preconfigure_service_item_state: ansible_facts.services['{{ __sap_hana_preconfigure_packages_and_services[line_item].svc }}.service'].state | ||
|
||
- name: Assert that service {{ __sap_hana_preconfigure_packages_and_services[line_item].svc }} is | ||
{{ __sap_hana_preconfigure_packages_and_services[line_item].svc_state }} or | ||
{{ __sap_hana_preconfigure_packages_and_services[line_item].systemd_state }} | ||
- name: Assert that service {{ __sap_hana_preconfigure_packages_and_services_svc }} is | ||
{{ __sap_hana_preconfigure_packages_and_services_svc_state }} or | ||
{{ __sap_hana_preconfigure_packages_and_services_systemd_state }} | ||
ansible.builtin.assert: | ||
that: (__sap_hana_preconfigure_service_item_state == __sap_hana_preconfigure_packages_and_services[line_item].svc_state) or | ||
(__sap_hana_preconfigure_service_item_state == __sap_hana_preconfigure_packages_and_services[line_item].systemd_state) | ||
fail_msg: "FAIL: Service '{{ __sap_hana_preconfigure_packages_and_services[line_item].svc }}' is not | ||
{{ __sap_hana_preconfigure_packages_and_services[line_item].svc_state }}!" | ||
success_msg: "PASS: Service '{{ __sap_hana_preconfigure_packages_and_services[line_item].svc }}' is | ||
{{ __sap_hana_preconfigure_packages_and_services[line_item].svc_state }} or | ||
{{ __sap_hana_preconfigure_packages_and_services[line_item].systemd_state }}." | ||
that: (__sap_hana_preconfigure_service_state == __sap_hana_preconfigure_packages_and_services_svc_state) or | ||
(__sap_hana_preconfigure_service_state == __sap_hana_preconfigure_packages_and_services_systemd_state) | ||
fail_msg: "FAIL: Service '{{ __sap_hana_preconfigure_packages_and_services_svc }}' is not | ||
{{ __sap_hana_preconfigure_packages_and_services_svc_state }}!" | ||
success_msg: "PASS: Service '{{ __sap_hana_preconfigure_packages_and_services_svc }}' is | ||
{{ __sap_hana_preconfigure_packages_and_services_svc_state }} or | ||
{{ __sap_hana_preconfigure_packages_and_services_systemd_state }}." | ||
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}" | ||
|
||
- name: "Report that package {{ __sap_hana_preconfigure_packages_and_services[line_item].pkg }} is not installed" | ||
- name: "Report that package {{ __sap_hana_preconfigure_packages_and_services_pkg }} is not installed" | ||
ansible.builtin.debug: | ||
msg: "PASS: Package '{{ __sap_hana_preconfigure_packages_and_services[line_item].pkg }}' is not installed." | ||
when: "__sap_hana_preconfigure_packages_and_services[line_item].pkg not in ansible_facts.packages" | ||
msg: "PASS: Package '{{ __sap_hana_preconfigure_packages_and_services_pkg }}' is not installed." | ||
when: "__sap_hana_preconfigure_packages_and_services_pkg not in ansible_facts.packages" |