Confirmed.
For me it also doesn't work if I give the vars through the CLI with
--extra-vars "test_var2 = TESTBAR"
On Sunday, June 14, 2015 at 2:23:43 AM UTC+2, Brian Picciano wrote:
>
> I have the following files:
>
> *roles/test/defaults/main.yml*
> ---
> test_var1: foo
> test_var2: bar
>
> *roles/test/handlers/main.yml*
> ---
> - name: "Testing handler - {{ test_var1 }} {{ test_var2 }}"
> debug: var=test_var2
>
>
> *roles/test/tasks/main.yml*
> ---
> - name: "Testing task - {{ test_var1 }}"
> debug: var=test_var1
> changed_when: True
> notify:
> - "Testing handler - {{ test_var1 }} {{ test_var2 }}"
>
> *playbooks/test.yml*
> ---
> - hosts: all
> roles:
> - role: test
> test_var1: FOO
> test_var2: BAR
>
> And running the test.yml playbook gives the following output:
>
> TASK: [test | Testing task - FOO]
> *********************************************
> changed: [127.0.0.1] => {
> "changed": true,
> "var": {
> "test_var": "FOO"
> }
> }
>
> NOTIFIED: [test | Testing handler - FOO BAR]
> **********************************
> ok: [127.0.0.1] => {
> "var": {
> "test_var2": "BAR"
> }
> }
>
> However, if I comment out the test_var2 instance in playbooks/test.yml,
> like this:
>
> ---
> - hosts: all
> roles:
> - role: test
> test_var1: FOO
> #test_var2: BAR
>
> Then the output looks like this:
>
> TASK: [test | Testing task - FOO]
> *********************************************
> changed: [127.0.0.1] => {
> "changed": true,
> "var": {
> "test_var": "FOO"
> }
> }
>
> NOTIFIED: [test | Testing handler - {{ test_var1 }} {{ test_var2 }}]
> **********
> ok: [127.0.0.1] => {
> "var": {
> "test_var2": "bar"
> }
> }
>
> In the NOTIFIED output the test variables don't actually get filled in,
> but in the previous output they were. Am I doing something wrong here or is
> this some kind of bug with ansible?
>
> This is all on ansible 1.9.1, on CentOS7
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e683db57-c222-4642-b4c7-0c9b145a91de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.