ansible-pull now handles all secret files CLI options (#82009) (#82070)

* ansible-pull added missing pasthrough for secrets

 Both become and connection password file options were missing.
 Also added test

(cherry picked from commit 99e0d25857)
pull/82221/head
Brian Coca 1 year ago committed by GitHub
parent 6cfa8ec021
commit e13569d0e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- ansible-pull will now correctly handle become and connection password file options for ansible-playbook.

@ -275,8 +275,15 @@ class PullCLI(CLI):
for vault_id in context.CLIARGS['vault_ids']:
cmd += " --vault-id=%s" % vault_id
if context.CLIARGS['become_password_file']:
cmd += " --become-password-file=%s" % context.CLIARGS['become_password_file']
if context.CLIARGS['connection_password_file']:
cmd += " --connection-password-file=%s" % context.CLIARGS['connection_password_file']
for ev in context.CLIARGS['extra_vars']:
cmd += ' -e %s' % shlex.quote(ev)
if context.CLIARGS['become_ask_pass']:
cmd += ' --ask-become-pass'
if context.CLIARGS['skip_tags']:

@ -0,0 +1,12 @@
- hosts: localhost
gather_facts: false
tasks:
- ping: data='{{ansible_password}}'
register: dumb
vars:
ansible_python_interpreter: '{{ansible_playbook_python}}'
- name: If we got here, password was passed!
assert:
that:
- "dumb.ping == 'Testing123'"

@ -36,7 +36,8 @@ function pass_tests {
fi
# test for https://github.com/ansible/ansible/issues/13681
if grep -E '127\.0\.0\.1.*ok' "${temp_log}"; then
# match play default output stats, was matching limit + docker
if grep -E '127\.0\.0\.1\s*: ok=' "${temp_log}"; then
cat "${temp_log}"
echo "Found host 127.0.0.1 in output. Only localhost should be present."
exit 1
@ -84,4 +85,6 @@ pass_tests
ANSIBLE_CONFIG='' ansible-pull -d "${pull_dir}" -U "${repo_dir}" "$@" multi_play_1.yml multi_play_2.yml | tee "${temp_log}"
pass_tests_multi
pass_tests_multi
ANSIBLE_CONFIG='' ansible-pull -d "${pull_dir}" -U "${repo_dir}" conn_secret.yml --connection-password-file "${repo_dir}/secret_connection_password" "$@"

Loading…
Cancel
Save