Skip to content
Snippets Groups Projects
Commit 49f473ce authored by Thomas Woerner's avatar Thomas Woerner
Browse files

test_hosts.yml: Use result.failed also for failed_when

For failed_when result.failed should be used to make sure that
the task fails if there was an error.

For the duplicate names in hosts test failed_when: not result.failed has
been added as this test needs to fail.
parent 41940304
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@
- name: "{{ host6_fqdn }}"
force: yes
register: result
failed_when: not result.changed
failed_when: not result.changed or result.failed
- name: Hosts host1..host6 present again
ipahost:
......@@ -66,7 +66,7 @@
- name: "{{ host6_fqdn }}"
force: yes
register: result
failed_when: result.changed
failed_when: result.changed or result.failed
- name: Hosts host1..host6 absent
ipahost:
......@@ -80,7 +80,7 @@
- name: "{{ host6_fqdn }}"
state: absent
register: result
failed_when: not result.changed
failed_when: not result.changed or result.failed
- name: Hosts host1..host6 absent again
ipahost:
......@@ -94,8 +94,10 @@
- name: "{{ host6_fqdn }}"
state: absent
register: result
failed_when: result.changed
failed_when: result.changed or result.failed
# Use failed_when: not result.failed as this test needs to fail because a
# host is added two times in the same task
- name: Duplicate names in hosts failure test
ipahost:
ipaadmin_password: SomeADMINpassword
......@@ -109,4 +111,4 @@
- name: "{{ host3_fqdn }}"
force: yes
register: result
failed_when: result.changed or "is used more than once" not in result.msg
failed_when: result.changed or not result.failed or "is used more than once" not in result.msg
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment