silence ansible errors about implicit localhost

This commit is contained in:
Nick Sweeting 2024-09-15 20:31:11 -07:00
parent fab80632b7
commit 8d69469887
No known key found for this signature in database

View file

@ -1,3 +1,4 @@
import os
from ansible_runner import Runner, RunnerConfig
from benedict import benedict
from rich.pretty import pprint
@ -8,6 +9,9 @@ GLOBAL_CACHE = {}
IGNORED_VARS = ('OUTPUT', 'STDOUT', 'STDERR', 'RC', 'CMD')
# IGNORED_VARS = ()
os.environ['ANSIBLE_INVENTORY_UNPARSED_WARNING'] = 'False'
os.environ['ANSIBLE_LOCALHOST_WARNING'] = 'False'
def run_playbook(name, extravars=None, getvars=IGNORED_VARS):
_discarded = [GLOBAL_CACHE.pop(key) for key in IGNORED_VARS if key in GLOBAL_CACHE]
rc = RunnerConfig(