mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 14:01:42 -07: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:
parent
2984ffdfac
commit
88772b6003
8 changed files with 133 additions and 9 deletions
|
@ -151,11 +151,30 @@ class PlayIterator:
|
|||
self._play = play
|
||||
self._blocks = []
|
||||
|
||||
# Default options to gather
|
||||
gather_subset = C.DEFAULT_GATHER_SUBSET
|
||||
ignore_ohai = C.DEFAULT_IGNORE_OHAI
|
||||
ignore_facter = C.DEFAULT_IGNORE_FACTER
|
||||
|
||||
# Retrieve subset to gather
|
||||
if self._play.gather_subset is not None:
|
||||
gather_subset = self._play.gather_subset
|
||||
# ignore ohai
|
||||
if self._play.ignore_ohai is not None:
|
||||
ignore_ohai = self._play.ignore_ohai
|
||||
# ignore puppet facter
|
||||
if self._play.ignore_facter is not None:
|
||||
ignore_facter = self._play.ignore_facter
|
||||
|
||||
setup_block = Block(play=self._play)
|
||||
setup_task = Task(block=setup_block)
|
||||
setup_task.action = 'setup'
|
||||
setup_task.tags = ['always']
|
||||
setup_task.args = {}
|
||||
setup_task.args = {
|
||||
'gather_subset': gather_subset,
|
||||
'ignore_ohai' : ignore_ohai,
|
||||
'ignore_facter': ignore_facter,
|
||||
}
|
||||
setup_task.set_loader(self._play._loader)
|
||||
setup_block.block = [setup_task]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue