-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
ansible_mitogen: Support templated `become_user`
- Loading branch information
Showing
12 changed files
with
122 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
16 changes: 16 additions & 0 deletions
16
tests/ansible/integration/become/templated_by_play_keywords.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
16 changes: 16 additions & 0 deletions
16
tests/ansible/integration/become/templated_by_play_vars.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
27 changes: 27 additions & 0 deletions
27
tests/ansible/integration/become/templated_by_task_keywords.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters