diff --git a/tests/test_playbooks/inventory_plugin.yml b/tests/test_playbooks/inventory_plugin.yml index 9305b22ec8..f1dd292961 100644 --- a/tests/test_playbooks/inventory_plugin.yml +++ b/tests/test_playbooks/inventory_plugin.yml @@ -3,7 +3,9 @@ vars: foreman_groups: - name: group_a + label: group_a - name: group_b + label: group_b - name: group_c label: group_b/group_c parent: group_b diff --git a/tests/test_playbooks/inventory_plugin_ansible.yml b/tests/test_playbooks/inventory_plugin_ansible.yml index 5e5e7c4bdd..ae6c31dd95 100644 --- a/tests/test_playbooks/inventory_plugin_ansible.yml +++ b/tests/test_playbooks/inventory_plugin_ansible.yml @@ -3,7 +3,9 @@ vars: foreman_groups: - name: group_a + label: group_a - name: group_b + label: group_b - name: group_c label: group_b/group_c parent: group_b diff --git a/tests/test_playbooks/tasks/inventory_plugin_tests.yml b/tests/test_playbooks/tasks/inventory_plugin_tests.yml index ad2e522c90..3838935755 100644 --- a/tests/test_playbooks/tasks/inventory_plugin_tests.yml +++ b/tests/test_playbooks/tasks/inventory_plugin_tests.yml @@ -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 }}"