2016-03-12 09:22:49 +00:00
|
|
|
---
|
|
|
|
|
2016-03-15 01:48:40 +00:00
|
|
|
- hosts: facthost0
|
2016-03-15 18:58:23 +00:00
|
|
|
tags: [ 'fact_min' ]
|
|
|
|
connection: local
|
|
|
|
gather_subset: "all"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- setup:
|
|
|
|
register: facts
|
|
|
|
- debug: var=facts
|
2016-03-15 19:31:26 +00:00
|
|
|
- name: Test that retrieving all facts works
|
2016-03-15 18:58:23 +00:00
|
|
|
assert:
|
|
|
|
that:
|
2016-03-15 19:31:26 +00: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 18:58:23 +00:00
|
|
|
|
|
|
|
- hosts: facthost1
|
2016-03-15 01:48:40 +00:00
|
|
|
tags: [ 'fact_min' ]
|
2016-03-12 09:22:49 +00:00
|
|
|
connection: local
|
2016-03-14 21:50:27 +00:00
|
|
|
gather_subset: "!all"
|
2016-03-12 09:22:49 +00:00
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2016-03-15 01:48:40 +00:00
|
|
|
- name: Test that only retrieving minimal facts work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-03-15 19:31:26 +00: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 09:22:49 +00:00
|
|
|
|
2016-03-15 18:58:23 +00:00
|
|
|
- hosts: facthost2
|
2016-03-15 01:48:40 +00:00
|
|
|
tags: [ 'fact_network' ]
|
2016-03-12 09:22:49 +00:00
|
|
|
connection: local
|
|
|
|
gather_subset: "network"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2016-03-15 01:48:40 +00:00
|
|
|
- name: Test that retrieving network facts work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-03-15 19:31:26 +00: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 09:22:49 +00:00
|
|
|
|
2016-03-15 18:58:23 +00:00
|
|
|
- hosts: facthost3
|
2016-03-15 01:48:40 +00:00
|
|
|
tags: [ 'fact_hardware' ]
|
2016-03-12 09:22:49 +00:00
|
|
|
connection: local
|
|
|
|
gather_subset: "hardware"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2016-03-15 01:48:40 +00:00
|
|
|
- name: Test that retrieving hardware facts work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-03-15 19:31:26 +00: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 09:22:49 +00:00
|
|
|
|
2016-03-15 18:58:23 +00:00
|
|
|
- hosts: facthost4
|
2016-03-15 01:48:40 +00:00
|
|
|
tags: [ 'fact_virtual' ]
|
2016-03-12 09:22:49 +00:00
|
|
|
connection: local
|
|
|
|
gather_subset: "virtual"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
2016-03-15 01:48:40 +00:00
|
|
|
- name: Test that retrieving virtualization facts work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-03-15 19:31:26 +00: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 01:48:40 +00:00
|
|
|
|
2016-03-15 18:58:23 +00:00
|
|
|
- hosts: facthost5
|
2016-03-15 01:48:40 +00: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-03-15 19:31:26 +00: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 01:48:40 +00:00
|
|
|
|
2016-03-15 18:58:23 +00:00
|
|
|
- hosts: facthost6
|
2016-03-15 01:48:40 +00: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-03-15 19:31:26 +00: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 01:48:40 +00:00
|
|
|
|
2016-03-15 18:58:23 +00:00
|
|
|
- hosts: facthost7
|
2016-03-15 01:48:40 +00:00
|
|
|
tags: [ 'fact_negation' ]
|
|
|
|
connection: local
|
|
|
|
gather_subset: "!hardware"
|
|
|
|
gather_facts: yes
|
|
|
|
tasks:
|
|
|
|
- name: Test that negation of fact subsets work
|
|
|
|
assert:
|
|
|
|
that:
|
2016-03-15 19:31:26 +00: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 01:48:40 +00:00
|
|
|
|
2016-03-15 18:58:23 +00:00
|
|
|
- hosts: facthost8
|
2016-03-15 01:48:40 +00: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-03-15 19:31:26 +00: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 01:48:40 +00:00
|
|
|
|