2016-03-12 10:22:49 +01:00
|
|
|
---
|
|
|
|
|
2016-03-15 02:48:40 +01:00
|
|
|
- hosts: facthost0
|
2016-03-15 19:58:23 +01:00
|
|
|
tags: [ 'fact_min' ]
|
|
|
|
connection: local
|
|
|
|
gather_subset: "all"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- setup:
|
|
|
|
register: facts
|
2016-03-15 20:31:26 +01:00
|
|
|
- name: Test that retrieving all facts works
|
2016-03-15 19:58:23 +01:00
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") != "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_NET") != "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") != "UNDEF_VIRT"'
|
2016-03-15 19:58:23 +01:00
|
|
|
|
|
|
|
- hosts: facthost1
|
2016-03-15 02:48:40 +01:00
|
|
|
tags: [ 'fact_min' ]
|
2016-03-12 10:22:49 +01:00
|
|
|
connection: local
|
2016-03-14 22:50:27 +01:00
|
|
|
gather_subset: "!all"
|
2016-03-12 10:22:49 +01:00
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2016-03-15 02:48:40 +01:00
|
|
|
- name: Test that only retrieving minimal facts work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") == "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_HW") == "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") == "UNDEF_VIRT"'
|
2016-03-12 10:22:49 +01:00
|
|
|
|
2016-03-15 19:58:23 +01:00
|
|
|
- hosts: facthost2
|
2016-03-15 02:48:40 +01:00
|
|
|
tags: [ 'fact_network' ]
|
2016-03-12 10:22:49 +01:00
|
|
|
connection: local
|
|
|
|
gather_subset: "network"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2016-03-15 02:48:40 +01:00
|
|
|
- name: Test that retrieving network facts work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") != "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_HW") == "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") == "UNDEF_VIRT"'
|
2016-03-12 10:22:49 +01:00
|
|
|
|
2016-03-15 19:58:23 +01:00
|
|
|
- hosts: facthost3
|
2016-03-15 02:48:40 +01:00
|
|
|
tags: [ 'fact_hardware' ]
|
2016-03-12 10:22:49 +01:00
|
|
|
connection: local
|
|
|
|
gather_subset: "hardware"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2016-03-15 02:48:40 +01:00
|
|
|
- name: Test that retrieving hardware facts work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") == "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_HW") != "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") == "UNDEF_VIRT"'
|
2016-03-12 10:22:49 +01:00
|
|
|
|
2016-03-15 19:58:23 +01:00
|
|
|
- hosts: facthost4
|
2016-03-15 02:48:40 +01:00
|
|
|
tags: [ 'fact_virtual' ]
|
2016-03-12 10:22:49 +01:00
|
|
|
connection: local
|
|
|
|
gather_subset: "virtual"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2016-03-15 02:48:40 +01:00
|
|
|
- name: Test that retrieving virtualization facts work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") == "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_HW") == "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") != "UNDEF_VIRT"'
|
2016-03-15 02:48:40 +01:00
|
|
|
|
2016-03-15 19:58:23 +01:00
|
|
|
- hosts: facthost5
|
2016-03-15 02:48:40 +01:00
|
|
|
tags: [ 'fact_comma_string' ]
|
|
|
|
connection: local
|
|
|
|
gather_subset: "virtual,network"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- name: Test that retrieving virtualization and network as a string works
|
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") != "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_HW") == "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") != "UNDEF_VIRT"'
|
2016-03-15 02:48:40 +01:00
|
|
|
|
2016-03-15 19:58:23 +01:00
|
|
|
- hosts: facthost6
|
2016-03-15 02:48:40 +01:00
|
|
|
tags: [ 'fact_yaml_list' ]
|
|
|
|
connection: local
|
|
|
|
gather_subset:
|
|
|
|
- virtual
|
|
|
|
- network
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- name: Test that retrieving virtualization and network as a string works
|
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") != "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_HW") == "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") != "UNDEF_VIRT"'
|
2016-03-15 02:48:40 +01:00
|
|
|
|
2016-03-15 19:58:23 +01:00
|
|
|
- hosts: facthost7
|
2016-03-15 02:48:40 +01:00
|
|
|
tags: [ 'fact_negation' ]
|
|
|
|
connection: local
|
|
|
|
gather_subset: "!hardware"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- name: Test that negation of fact subsets work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") != "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_HW") == "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") != "UNDEF_VIRT"'
|
2016-03-15 02:48:40 +01:00
|
|
|
|
2016-03-15 19:58:23 +01:00
|
|
|
- hosts: facthost8
|
2016-03-15 02:48:40 +01:00
|
|
|
tags: [ 'fact_mixed_negation_addition' ]
|
|
|
|
connection: local
|
|
|
|
gather_subset: "!hardware,network"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- name: Test that negation and additional subsets work together
|
|
|
|
assert:
|
|
|
|
that:
|
2016-10-26 17:21:19 +02:00
|
|
|
- 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"'
|
|
|
|
- 'ansible_interfaces|default("UNDEF_NET") != "UNDEF_NET"'
|
|
|
|
- 'ansible_mounts|default("UNDEF_HW") == "UNDEF_HW"'
|
|
|
|
- 'ansible_virtualization_role|default("UNDEF_VIRT") == "UNDEF_VIRT"'
|