* fix delegation vars usage (debug still shows inventory_hostname) (#69244) * fix delegation vars usage and reporting - just pass delegated host vars + task vars to plugins and avoid poluting with original host vars - updated tests (cherry picked from commit2165f9ac40) * fix delegated interpreter discovery (#69604) * fix delegated interpeter * allow returning fact if it is 'the right host' * added note for future fix/efficiency as it stands we rerun discovery for the delegated host unless its saving facts to itself * fixed test lacking delegate_to mock (cherry picked from commitde3f7c7739) * Fix `ansible -K` become_pass regression (#69629) * Fix `ansible -K` become_pass regression Change: - This fixes a breaking change introduced in2165f9ac40Test Plan: - Local VM for now, with plans to add an integration test for -K going forward. Tickets: Refs #69244 (cherry picked from commitfe9696be52) * fix discovery on loop with delegation (#70013) * fix discovery on loop with delegation fixes #69963 (cherry picked from commit4c9d9dbb56) Co-authored-by: Rick Elrod <rick@elrod.me>
43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
- hosts: localhost
|
|
gather_facts: yes
|
|
roles:
|
|
- setup_pexpect
|
|
|
|
tasks:
|
|
- name: Test ansible-playbook and ansible with -K
|
|
block:
|
|
- name: Create user to connect as
|
|
user:
|
|
name: cliuser1
|
|
shell: /bin/bash
|
|
groups: wheel
|
|
append: yes
|
|
password: "{{ 'secretpassword' | password_hash('sha512', 'mysecretsalt') }}"
|
|
- name: Create user to become
|
|
user:
|
|
name: cliuser2
|
|
shell: /bin/bash
|
|
password: "{{ 'secretpassword' | password_hash('sha512', 'mysecretsalt') }}"
|
|
# Sometimes this file doesn't get removed, and we need it gone to ssh
|
|
- name: Remove /run/nologin
|
|
file:
|
|
path: /run/nologin
|
|
state: absent
|
|
# Make Ansible run Python to run Ansible
|
|
- name: Run the test
|
|
shell: python test_k_and_K.py {{ ansible_python_interpreter }}
|
|
always:
|
|
- name: Remove users
|
|
user:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
with_items:
|
|
- cliuser1
|
|
- cliuser2
|
|
# For now, we don't test this everywhere, because `user` works differently
|
|
# on some platforms, as does sudo/sudoers. On Fedora, we can just add
|
|
# the user to 'wheel' and things magically work.
|
|
# TODO: In theory, we should test this with all the different 'become'
|
|
# plugins in base.
|
|
when: ansible_distribution == 'Fedora'
|