Merge pull request #1148 from mordekasg/#1083
ansible_mitogen: Support templated `become_user`pull/1163/head
commit
a07489dbd4
@ -0,0 +1,14 @@
|
|||||||
|
- name: integration/become/templated_by_inv.yml
|
||||||
|
hosts: tt_become_by_inv
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- meta: reset_connection
|
||||||
|
- name: Templated become in inventory
|
||||||
|
command:
|
||||||
|
cmd: whoami
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
register: become_templated_by_inv_whoami
|
||||||
|
failed_when:
|
||||||
|
- become_templated_by_inv_whoami is failed
|
||||||
|
or become_templated_by_inv_whoami.stdout != 'root'
|
@ -0,0 +1,16 @@
|
|||||||
|
- name: integration/become/templated_by_play_keywords.yml
|
||||||
|
hosts: tt_become_bare
|
||||||
|
gather_facts: false
|
||||||
|
become: true
|
||||||
|
become_user: "{{ 'root' | trim }}"
|
||||||
|
tasks:
|
||||||
|
- meta: reset_connection
|
||||||
|
- name: Templated become by play keywords
|
||||||
|
command:
|
||||||
|
cmd: whoami
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
register: become_templated_by_play_keywords_whoami
|
||||||
|
failed_when:
|
||||||
|
- become_templated_by_play_keywords_whoami is failed
|
||||||
|
or become_templated_by_play_keywords_whoami.stdout != 'root'
|
@ -0,0 +1,16 @@
|
|||||||
|
- name: integration/become/templated_by_play_vars.yml
|
||||||
|
hosts: tt_become_bare
|
||||||
|
gather_facts: false
|
||||||
|
vars:
|
||||||
|
ansible_become: true
|
||||||
|
ansible_become_user: "{{ 'root' | trim }}"
|
||||||
|
tasks:
|
||||||
|
- name: Templated become by play vars
|
||||||
|
command:
|
||||||
|
cmd: whoami
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
register: become_templated_by_play_vars_whoami
|
||||||
|
failed_when:
|
||||||
|
- become_templated_by_play_vars_whoami is failed
|
||||||
|
or become_templated_by_play_vars_whoami.stdout != 'root'
|
@ -0,0 +1,27 @@
|
|||||||
|
- name: integration/become/templated_by_task_keywords.yml
|
||||||
|
hosts: tt_become_bare
|
||||||
|
gather_facts: false
|
||||||
|
# FIXME Resetting the connection shouldn't require credentials
|
||||||
|
# https://github.com/mitogen-hq/mitogen/issues/1132
|
||||||
|
become: true
|
||||||
|
become_user: "{{ 'root' | trim }}"
|
||||||
|
tasks:
|
||||||
|
- name: Reset connection to target that will be delegate_to
|
||||||
|
meta: reset_connection
|
||||||
|
|
||||||
|
- name: Test connection template by task keywords, with delegate_to
|
||||||
|
hosts: test-targets[0]
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: Templated become by task keywords, with delegate_to
|
||||||
|
become: true
|
||||||
|
become_user: "{{ 'root' | trim }}"
|
||||||
|
delegate_to: "{{ groups.tt_become_bare[0] }}"
|
||||||
|
command:
|
||||||
|
cmd: whoami
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
register: become_templated_by_task_with_delegate_to_whoami
|
||||||
|
failed_when:
|
||||||
|
- become_templated_by_task_with_delegate_to_whoami is failed
|
||||||
|
or become_templated_by_task_with_delegate_to_whoami.stdout != 'root'
|
Loading…
Reference in New Issue