Add --flush-cache option to ansible-pull (#84211)

pull/84208/head
Sloane Hertel 3 weeks ago committed by GitHub
parent 771f7ad29c
commit 157ef04b1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,2 +1,3 @@
minor_changes:
- ansible cli - add --flush-cache option for ad-hoc commands (https://github.com/ansible/ansible/issues/83749).
- >
ansible, ansible-console, ansible-pull - add --flush-cache option (https://github.com/ansible/ansible/issues/83749).

@ -298,6 +298,9 @@ class PullCLI(CLI):
if context.CLIARGS['diff']:
cmd += ' -D'
if context.CLIARGS['flush_cache']:
cmd += ' --flush-cache'
os.chdir(context.CLIARGS['dest'])
# redo inventory options as new files might exist now

@ -0,0 +1,5 @@
- hosts: localhost
gather_facts: false
tasks:
- assert:
that: ansible_facts == {}

@ -91,3 +91,9 @@ ANSIBLE_CONFIG='' ansible-pull -d "${pull_dir}" -U "${repo_dir}" conn_secret.yml
# fail if we try do delete /var/tmp
ANSIBLE_CONFIG='' ansible-pull -d var/tmp -U "${repo_dir}" --purge "$@"
# test flushing the fact cache
export ANSIBLE_CACHE_PLUGIN=jsonfile ANSIBLE_CACHE_PLUGIN_CONNECTION=./
ansible-pull -d "${pull_dir}" -U "${repo_dir}" "$@" gather_facts.yml
ansible-pull -d "${pull_dir}" -U "${repo_dir}" --flush-cache "$@" test_empty_facts.yml
unset ANSIBLE_CACHE_PLUGIN ANSIBLE_CACHE_PLUGIN_CONNECTION

Loading…
Cancel
Save