mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
add a fact gathering check for the default of all
This commit is contained in:
parent
86080fbaa9
commit
9a6a5a5516
2 changed files with 25 additions and 8 deletions
|
@ -5,7 +5,7 @@ testhost2 ansible_ssh_host=127.0.0.1 ansible_connection=local
|
||||||
testhost3 ansible_ssh_host=127.0.0.3
|
testhost3 ansible_ssh_host=127.0.0.3
|
||||||
testhost4 ansible_ssh_host=127.0.0.4
|
testhost4 ansible_ssh_host=127.0.0.4
|
||||||
# For testing fact gathering
|
# For testing fact gathering
|
||||||
facthost[0:7] ansible_host=1270.0.0.1 ansible_connection=local
|
facthost[0:8] ansible_host=1270.0.0.1 ansible_connection=local
|
||||||
|
|
||||||
|
|
||||||
# the following inline declarations are accompanied
|
# the following inline declarations are accompanied
|
||||||
|
|
|
@ -1,6 +1,23 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: facthost0
|
- hosts: facthost0
|
||||||
|
tags: [ 'fact_min' ]
|
||||||
|
connection: local
|
||||||
|
gather_subset: "all"
|
||||||
|
gather_facts: yes
|
||||||
|
tasks:
|
||||||
|
- setup:
|
||||||
|
register: facts
|
||||||
|
- debug: var=facts
|
||||||
|
- name: Test that only retrieving minimal facts work
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- '"{{ ansible_user_id|default("UNDEF") }}" != "UNDEF"'
|
||||||
|
- '"{{ ansible_interfaces|default("UNDEF") }}" != "UNDEF"'
|
||||||
|
- '"{{ ansible_mounts|default("UNDEF") }}" != "UNDEF"'
|
||||||
|
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
||||||
|
|
||||||
|
- hosts: facthost1
|
||||||
tags: [ 'fact_min' ]
|
tags: [ 'fact_min' ]
|
||||||
connection: local
|
connection: local
|
||||||
gather_subset: "!all"
|
gather_subset: "!all"
|
||||||
|
@ -14,7 +31,7 @@
|
||||||
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
||||||
- '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"'
|
||||||
|
|
||||||
- hosts: facthost1
|
- hosts: facthost2
|
||||||
tags: [ 'fact_network' ]
|
tags: [ 'fact_network' ]
|
||||||
connection: local
|
connection: local
|
||||||
gather_subset: "network"
|
gather_subset: "network"
|
||||||
|
@ -28,7 +45,7 @@
|
||||||
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
||||||
- '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"'
|
||||||
|
|
||||||
- hosts: facthost2
|
- hosts: facthost3
|
||||||
tags: [ 'fact_hardware' ]
|
tags: [ 'fact_hardware' ]
|
||||||
connection: local
|
connection: local
|
||||||
gather_subset: "hardware"
|
gather_subset: "hardware"
|
||||||
|
@ -42,7 +59,7 @@
|
||||||
- '"{{ ansible_mounts|default("UNDEF") }}" != "UNDEF"'
|
- '"{{ ansible_mounts|default("UNDEF") }}" != "UNDEF"'
|
||||||
- '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_virtualization_role|default("UNDEF") }}" == "UNDEF"'
|
||||||
|
|
||||||
- hosts: facthost3
|
- hosts: facthost4
|
||||||
tags: [ 'fact_virtual' ]
|
tags: [ 'fact_virtual' ]
|
||||||
connection: local
|
connection: local
|
||||||
gather_subset: "virtual"
|
gather_subset: "virtual"
|
||||||
|
@ -56,7 +73,7 @@
|
||||||
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
||||||
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
||||||
|
|
||||||
- hosts: facthost4
|
- hosts: facthost5
|
||||||
tags: [ 'fact_comma_string' ]
|
tags: [ 'fact_comma_string' ]
|
||||||
connection: local
|
connection: local
|
||||||
gather_subset: "virtual,network"
|
gather_subset: "virtual,network"
|
||||||
|
@ -70,7 +87,7 @@
|
||||||
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
||||||
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
||||||
|
|
||||||
- hosts: facthost5
|
- hosts: facthost6
|
||||||
tags: [ 'fact_yaml_list' ]
|
tags: [ 'fact_yaml_list' ]
|
||||||
connection: local
|
connection: local
|
||||||
gather_subset:
|
gather_subset:
|
||||||
|
@ -86,7 +103,7 @@
|
||||||
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
||||||
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
||||||
|
|
||||||
- hosts: facthost6
|
- hosts: facthost7
|
||||||
tags: [ 'fact_negation' ]
|
tags: [ 'fact_negation' ]
|
||||||
connection: local
|
connection: local
|
||||||
gather_subset: "!hardware"
|
gather_subset: "!hardware"
|
||||||
|
@ -100,7 +117,7 @@
|
||||||
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
- '"{{ ansible_mounts|default("UNDEF") }}" == "UNDEF"'
|
||||||
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
- '"{{ ansible_virtualization_role|default("UNDEF") }}" != "UNDEF"'
|
||||||
|
|
||||||
- hosts: facthost7
|
- hosts: facthost8
|
||||||
tags: [ 'fact_mixed_negation_addition' ]
|
tags: [ 'fact_mixed_negation_addition' ]
|
||||||
connection: local
|
connection: local
|
||||||
gather_subset: "!hardware,network"
|
gather_subset: "!hardware,network"
|
||||||
|
|
Loading…
Reference in a new issue