@ -11,6 +11,82 @@
- "!hardware"
- "!hardware"
register : not_hardware_facts
register : not_hardware_facts
- name : min and network test for platform added
hosts : facthost21
tags : [ 'fact_network' ]
connection : local
gather_subset : "!all,network"
gather_facts : yes
tasks:
- name : Test that retrieving network facts works and gets prereqs from platform and distribution
assert:
that:
- 'ansible_default_ipv4|default("UNDEF") != "UNDEF"'
- 'ansible_interfaces|default("UNDEF") != "UNDEF"'
# these are true for linux, but maybe not for other os
- 'ansible_system|default("UNDEF") != "UNDEF"'
- 'ansible_distribution|default("UNDEF") != "UNDEF"'
# we dont really require these but they are in the min set
# - 'ansible_virtualization_role|default("UNDEF") == "UNDEF"'
# - 'ansible_user_id|default("UNDEF") == "UNDEF"'
# - 'ansible_env|default("UNDEF") == "UNDEF"'
# - 'ansible_selinux|default("UNDEF") == "UNDEF"'
# - 'ansible_pkg_mgr|default("UNDEF") == "UNDEF"'
- name : min and hardware test for platform added
hosts : facthost22
tags : [ 'fact_hardware' ]
connection : local
gather_subset : "hardware"
gather_facts : yes
tasks:
- name : debug stuff
debug:
var : hostvars['facthost22']
# we should also collect platform, but not distribution
- name : Test that retrieving hardware facts works and gets prereqs from platform and distribution
when : ansible_system|default("UNDEF") == "Linux"
assert:
# LinuxHardwareCollector requires 'platform' facts
that:
- 'ansible_memory_mb|default("UNDEF") != "UNDEF"'
- 'ansible_default_ipv4|default("UNDEF") == "UNDEF"'
- 'ansible_interfaces|default("UNDEF") == "UNDEF"'
# these are true for linux, but maybe not for other os
# hardware requires 'platform'
- 'ansible_system|default("UNDEF") != "UNDEF"'
- 'ansible_machine|default("UNDEF") != "UNDEF"'
# hardware does not require 'distribution' but it is min set
# - 'ansible_distribution|default("UNDEF") == "UNDEF"'
# we dont really require these but they are in the min set
# - 'ansible_virtualization_role|default("UNDEF") == "UNDEF"'
# - 'ansible_user_id|default("UNDEF") == "UNDEF"'
# - 'ansible_env|default("UNDEF") == "UNDEF"'
# - 'ansible_selinux|default("UNDEF") == "UNDEF"'
# - 'ansible_pkg_mgr|default("UNDEF") == "UNDEF"'
- name : min and service_mgr test for platform added
hosts : facthost23
tags : [ 'fact_service_mgr' ]
connection : local
gather_subset : "!all,service_mgr"
gather_facts : yes
tasks:
- name : Test that retrieving service_mgr facts works and gets prereqs from platform and distribution
assert:
that:
- 'ansible_service_mgr|default("UNDEF") != "UNDEF"'
- 'ansible_default_ipv4|default("UNDEF") == "UNDEF"'
- 'ansible_interfaces|default("UNDEF") == "UNDEF"'
# these are true for linux, but maybe not for other os
- 'ansible_system|default("UNDEF") != "UNDEF"'
- 'ansible_distribution|default("UNDEF") != "UNDEF"'
# we dont really require these but they are in the min set
# - 'ansible_virtualization_role|default("UNDEF") == "UNDEF"'
# - 'ansible_user_id|default("UNDEF") == "UNDEF"'
# - 'ansible_env|default("UNDEF") == "UNDEF"'
# - 'ansible_selinux|default("UNDEF") == "UNDEF"'
# - 'ansible_pkg_mgr|default("UNDEF") == "UNDEF"'
- hosts : facthost0
- hosts : facthost0
tags : [ 'fact_min' ]
tags : [ 'fact_min' ]
@ -18,8 +94,8 @@
gather_subset : "all"
gather_subset : "all"
gather_facts : yes
gather_facts : yes
tasks:
tasks:
- setup:
# - setup:
register : facts
# register: facts
- name : Test that retrieving all facts works
- name : Test that retrieving all facts works
assert:
assert:
that:
that:
@ -36,7 +112,7 @@
tasks:
tasks:
- setup:
- setup:
filter : "*env*"
filter : "*env*"
register : fact s _results
register : fact _results
- name : Test that retrieving all facts filtered to env works
- name : Test that retrieving all facts filtered to env works
assert:
assert:
@ -53,7 +129,7 @@
tasks:
tasks:
- setup:
- setup:
filter : "ansible_user_id"
filter : "ansible_user_id"
register : fact s _results
register : fact _results
- name : Test that retrieving all facts filtered to specific fact ansible_user_id works
- name : Test that retrieving all facts filtered to specific fact ansible_user_id works
assert:
assert:
@ -72,7 +148,7 @@
tasks:
tasks:
- setup:
- setup:
filter : "*"
filter : "*"
register : fact s
register : fact _result s
- name : Test that retrieving all facts filtered to splat
- name : Test that retrieving all facts filtered to splat
assert:
assert:
@ -89,7 +165,7 @@
tasks:
tasks:
- setup:
- setup:
filter : ""
filter : ""
register : fact s
register : fact _result s
- name : Test that retrieving all facts filtered to empty filter_spec works
- name : Test that retrieving all facts filtered to empty filter_spec works
assert:
assert:
@ -119,16 +195,16 @@
- hosts : facthost2
- hosts : facthost2
tags : [ 'fact_network' ]
tags : [ 'fact_network' ]
connection : local
connection : local
gather_subset : " network"
gather_subset : " !all,!min, network"
gather_facts : yes
gather_facts : yes
tasks:
tasks:
- name : Test that retrieving network facts work
- name : Test that retrieving network facts work
assert:
assert:
that:
that:
- 'ansible_user_id|default("UNDEF _MIN") != "UNDEF_MIN "'
- 'ansible_user_id|default("UNDEF ") == "UNDEF "'
- 'ansible_interfaces|default("UNDEF_NET") != "UNDEF_NET"'
- 'ansible_interfaces|default("UNDEF_NET") != "UNDEF_NET"'
- 'ansible_mounts|default("UNDEF _MOUNT ") == "UNDEF_MOUNT "'
- 'ansible_mounts|default("UNDEF ") == "UNDEF"'
- 'ansible_virtualization_role|default("UNDEF _VIRT ") == "UNDEF_VIRT "'
- 'ansible_virtualization_role|default("UNDEF ") == "UNDEF"'
- hosts : facthost3
- hosts : facthost3
tags : [ 'fact_hardware' ]
tags : [ 'fact_hardware' ]