silence ansible errors about implicit localhost
Some checks are pending
Build Pip package / build (push) Waiting to run
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Waiting to run
Run tests / docker_tests (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Build Debian package / build (push) Waiting to run
Build Docker image / buildx (push) Waiting to run
Build Homebrew package / build (push) Waiting to run
Build GitHub Pages website / build (push) Waiting to run
Build GitHub Pages website / deploy (push) Blocked by required conditions
Run linters / lint (push) Waiting to run

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(