forked from theforeman/foreman-ansible-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix jinja expressions in inventory tests
- Loading branch information
Showing
3 changed files
with
15 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
--- | ||
- name: test that all groups are present | ||
assert: | ||
that: > | ||
'foreman_{{ item.label | default(item.name) | regex_replace('/', '_') }}' in groups | ||
that: | ||
- "'foreman_{}'.format(item.label.replace('/', '_')) in groups" | ||
with_items: "{{ foreman_groups }}" | ||
|
||
- name: test that all hosts are in the "all" group | ||
assert: | ||
that: > | ||
'{{ item.key }}' in groups['all'] | ||
that: | ||
- "item.key in groups['all']" | ||
with_dict: "{{ foreman_hosts }}" | ||
|
||
- name: test that all hosts are in the correct hostgroup | ||
assert: | ||
that: > | ||
'{{ item.key }}' in groups['foreman_{{ item.value | regex_replace('/', '_') }}'] | ||
that: | ||
- "item.key in groups['foreman_{}'.format(item.value.replace('/', '_'))]" | ||
with_dict: "{{ foreman_hosts }}" | ||
|
||
- name: dump all host details | ||
debug: | ||
var: "hostvars['{{ item.key }}']" | ||
var: "hostvars[item.key]" | ||
with_dict: "{{ foreman_hosts }}" | ||
|
||
- name: test that all hosts have the domain fact set | ||
assert: | ||
that: > | ||
hostvars['{{ item.key }}']['foreman_facts']['domain'] == 'example.com' | ||
hostvars[item.key]['foreman_facts']['domain'] == 'example.com' | ||
with_dict: "{{ foreman_hosts }}" | ||
|
||
- name: test that all hosts have the OS fact set | ||
assert: | ||
that: > | ||
hostvars['{{ item.key }}']['foreman_facts']['operatingsystem'] == 'CentOS' | ||
hostvars[item.key]['foreman_facts']['operatingsystem'] == 'CentOS' | ||
with_dict: "{{ foreman_hosts }}" | ||
|
||
- name: test that all hosts have the testparam1 | ||
assert: | ||
that: > | ||
hostvars['{{ item.key }}']['testparam1'] == 'testvalue1' | ||
hostvars[item.key]['testparam1'] == 'testvalue1' | ||
with_dict: "{{ foreman_hosts }}" | ||
|
||
- name: test that all hosts have the testparam2 | ||
assert: | ||
that: > | ||
hostvars['{{ item.key }}']['testparam2'] == 'testvalue2' | ||
hostvars[item.key]['testparam2'] == 'testvalue2' | ||
with_dict: "{{ foreman_hosts }}" |