mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Add a way to restrict gathered facts in Ansible:
- Using gather_subset options - By ignoring ohai/chef or facter/puppet facts
This commit is contained in:
committed by
Toshio Kuratomi
parent
2984ffdfac
commit
88772b6003
45
test/integration/test_gathering_facts.yml
Normal file
45
test/integration/test_gathering_facts.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
|
||||
- hosts: localhost
|
||||
tags: [ 'min' ]
|
||||
connection: local
|
||||
gather_subset: "min"
|
||||
ignore_facter: yes
|
||||
ignore_ohai: yes
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- debug: var={{item}}
|
||||
with_items: [ 'ansible_user_id', 'ansible_interfaces', 'ansible_mounts', 'ansible_virtualization_role' ]
|
||||
|
||||
- hosts: localhost
|
||||
tags: [ 'network' ]
|
||||
connection: local
|
||||
gather_subset: "network"
|
||||
ignore_facter: yes
|
||||
ignore_ohai: yes
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- debug: var={{item}}
|
||||
with_items: [ 'ansible_user_id', 'ansible_interfaces', 'ansible_mounts', 'ansible_virtualization_role' ]
|
||||
|
||||
- hosts: localhost
|
||||
tags: [ 'hardware' ]
|
||||
connection: local
|
||||
gather_subset: "hardware"
|
||||
ignore_facter: yes
|
||||
ignore_ohai: yes
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- debug: var={{item}}
|
||||
with_items: [ 'ansible_user_id', 'ansible_interfaces', 'ansible_mounts', 'ansible_virtualization_role' ]
|
||||
|
||||
- hosts: localhost
|
||||
tags: [ 'virtual' ]
|
||||
connection: local
|
||||
gather_subset: "virtual"
|
||||
ignore_facter: yes
|
||||
ignore_ohai: yes
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- debug: var={{item}}
|
||||
with_items: [ 'ansible_user_id', 'ansible_interfaces', 'ansible_mounts', 'ansible_virtualization_role' ]
|
||||
Reference in New Issue
Block a user