forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
template connection variables accessed directly before using (ansible…
…#70657) * template variables accessed directly when using them instead of FieldAttributes
- Loading branch information
Showing
4 changed files
with
45 additions
and
3 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
26 changes: 26 additions & 0 deletions
26
test/integration/targets/var_templating/test_connection_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,26 @@ | ||
--- | ||
- hosts: localhost | ||
gather_facts: no | ||
vars: | ||
my_var: | ||
become_method: sudo | ||
connection: local | ||
become: 1 | ||
tasks: | ||
|
||
- include_vars: "./vars/connection.yml" | ||
|
||
- command: whoami | ||
ignore_errors: yes | ||
register: result | ||
failed_when: result is not success and (result.module_stderr is defined or result.module_stderr is defined) | ||
|
||
- assert: | ||
that: | ||
- "'sudo' in result.module_stderr" | ||
when: result is not success and result.module_stderr is defined | ||
|
||
- assert: | ||
that: | ||
- "'Invalid become method specified' not in result.msg" | ||
when: result is not success and result.msg is defined |
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,3 @@ | ||
ansible_become: "{{ my_var.become }}" | ||
ansible_become_method: "{{ my_var.become_method }}" | ||
ansible_connection: "{{ my_var.connection }}" |