diff --git a/test/integration/targets/group_by/group_vars/camelus b/test/integration/targets/group_by/group_vars/camelus new file mode 100644 index 0000000000..b214ad6962 --- /dev/null +++ b/test/integration/targets/group_by/group_vars/camelus @@ -0,0 +1 @@ +dos: 'two' diff --git a/test/integration/targets/group_by/group_vars/vicugna b/test/integration/targets/group_by/group_vars/vicugna new file mode 100644 index 0000000000..8feb93fc99 --- /dev/null +++ b/test/integration/targets/group_by/group_vars/vicugna @@ -0,0 +1 @@ +tres: 'three' diff --git a/test/integration/targets/group_by/inventory.group_by b/test/integration/targets/group_by/inventory.group_by index d8d285dee5..9c7fe7ee71 100644 --- a/test/integration/targets/group_by/inventory.group_by +++ b/test/integration/targets/group_by/inventory.group_by @@ -1,3 +1,6 @@ +# ungrouped +camel genus=camelus ansible_connection=local + [lamini] alpaca genus=vicugna llama genus=lama diff --git a/test/integration/targets/group_by/test_group_by.yml b/test/integration/targets/group_by/test_group_by.yml index 3c299aa728..21f76bcb22 100644 --- a/test/integration/targets/group_by/test_group_by.yml +++ b/test/integration/targets/group_by/test_group_by.yml @@ -17,7 +17,7 @@ # along with Ansible. If not, see . - name: Create overall groups - hosts: lamini + hosts: all gather_facts: false tasks: - debug: var=genus @@ -51,6 +51,15 @@ - name: set a fact to check that we ran this play set_fact: genus_lama=true +- name: Camelus group validation + hosts: camelus + gather_facts: false + tasks: + - name: verify that only the camel is in this group + assert: { that: "inventory_hostname == 'camel'" } + - name: set a fact to check that we ran this play + set_fact: genus_camelus=true + - name: Vic group validation hosts: vic gather_facts: false @@ -69,6 +78,15 @@ - name: set a fact to check that we ran this play set_fact: genus_lam=true +- name: Cam group validation + hosts: cam + gather_facts: false + tasks: + - name: verify that only the camel is in this group + assert: { that: "inventory_hostname == 'camel'" } + - name: set a fact to check that we ran this play + set_fact: genus_cam=true + - name: Vi group validation hosts: vi gather_facts: false @@ -87,6 +105,15 @@ - name: set a fact to check that we ran this play set_fact: genus_la=true +- name: Ca group validation + hosts: ca + gather_facts: false + tasks: + - name: verify that only the camel is in this group + assert: { that: "inventory_hostname == 'camel'" } + - name: set a fact to check that we ran this play + set_fact: genus_ca=true + - name: VICUGNA group validation hosts: VICUGNA gather_facts: false @@ -105,6 +132,15 @@ - name: set a fact to check that we ran this play set_fact: genus_LAMA=true +- name: CAMELUS group validation + hosts: CAMELUS + gather_facts: false + tasks: + - name: verify that only the camel is in this group + assert: { that: "inventory_hostname == 'camel'" } + - name: set a fact to check that we ran this play + set_fact: genus_CAMELUS=true + - name: genus group validation (expect skipped) hosts: 'genus' gather_facts: false @@ -125,3 +161,27 @@ tasks: - name: check that llama matched all four groups assert: { that: ["genus_lama", "genus_lam", "genus_la", "genus_LAMA"] } + +- hosts: camel + gather_facts: false + tasks: + - name: check that camel matched all four groups + assert: { that: ["genus_camelus", "genus_cam", "genus_ca", "genus_CAMELUS"] } + +- hosts: vicugna + gather_facts: false + tasks: + - name: check group_vars variable overrides for vicugna + assert: { that: ["uno == 1", "dos == 2", "tres == 'three'"] } + +- hosts: lama + gather_facts: false + tasks: + - name: check group_vars variable overrides for lama + assert: { that: ["uno == 1", "dos == 2", "tres == 3"] } + +- hosts: camelus + gather_facts: false + tasks: + - name: check group_vars variable overrides for camelus + assert: { that: ["uno == 1", "dos == 'two'", "tres == 3"] }