|
|
@ -5,7 +5,8 @@
|
|
|
|
become_user: "{{ 'root' | trim }}"
|
|
|
|
become_user: "{{ 'root' | trim }}"
|
|
|
|
tasks:
|
|
|
|
tasks:
|
|
|
|
- meta: reset_connection
|
|
|
|
- meta: reset_connection
|
|
|
|
- name: Templated become by play keywords
|
|
|
|
|
|
|
|
|
|
|
|
- name: Templated become by play keywords, no password
|
|
|
|
command:
|
|
|
|
command:
|
|
|
|
cmd: whoami
|
|
|
|
cmd: whoami
|
|
|
|
changed_when: false
|
|
|
|
changed_when: false
|
|
|
@ -14,3 +15,26 @@
|
|
|
|
failed_when:
|
|
|
|
failed_when:
|
|
|
|
- become_templated_by_play_keywords_whoami is failed
|
|
|
|
- become_templated_by_play_keywords_whoami is failed
|
|
|
|
or become_templated_by_play_keywords_whoami.stdout != 'root'
|
|
|
|
or become_templated_by_play_keywords_whoami.stdout != 'root'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: integration/become/templated_by_play_keywords.yml
|
|
|
|
|
|
|
|
hosts: tt_become_bare
|
|
|
|
|
|
|
|
gather_facts: true
|
|
|
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
become_user: "{{ 'mitogen__pw_required' | trim }}"
|
|
|
|
|
|
|
|
vars:
|
|
|
|
|
|
|
|
ansible_become_pass: "{{ 'pw_required_password' | trim }}"
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: Templated become by play keywords, password
|
|
|
|
|
|
|
|
command:
|
|
|
|
|
|
|
|
cmd: whoami
|
|
|
|
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
check_mode: false
|
|
|
|
|
|
|
|
register: become_templated_by_play_keywords_password_whoami
|
|
|
|
|
|
|
|
failed_when:
|
|
|
|
|
|
|
|
- become_templated_by_play_keywords_password_whoami is failed
|
|
|
|
|
|
|
|
or become_templated_by_play_keywords_password_whoami.stdout != 'mitogen__pw_required'
|
|
|
|
|
|
|
|
when:
|
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/pull/70785
|
|
|
|
|
|
|
|
- ansible_facts.distribution not in ["MacOSX"]
|
|
|
|
|
|
|
|
or ansible_version.full is version("2.11", ">=", strict=True)
|
|
|
|
|
|
|
|
or is_mitogen
|
|
|
|