Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra var not present when host var evaluated #9667

Closed
jscheid opened this issue Nov 29, 2014 · 3 comments
Closed

Extra var not present when host var evaluated #9667

jscheid opened this issue Nov 29, 2014 · 3 comments
Labels
bug This issue/PR relates to a bug. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed

Comments

@jscheid
Copy link

jscheid commented Nov 29, 2014

Issue Type:

Bug Report

Ansible Version:

1.8.0 (bug introduced by f1267c0#diff-af869caf5f6f46706dbf35970e39c686R1166)

Environment:

N/A

Summary:

Can't rely anymore on extra variables being present when host variables are evaluated.

Steps To Reproduce:

Run the playbook in https://gist.github.com/jscheid/fac33da8580ad1880606

More generally:

  • Define a host variable that applies to_json to an extra variable
  • Use the template action
Expected Results:

Extra variables should always be set when host variables are being evaluated.

Output with 716f3eb:

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [127.0.0.1]

TASK: [template src=/dev/null dest=/dev/null] ********************************* 
ok: [127.0.0.1]

PLAY RECAP ******************************************************************** 
127.0.0.1                  : ok=2    changed=0    unreachable=0    failed=0   
Actual Results:

Extra variables aren't always set when host variables are being evaluated.

Output with f1267c0:

PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [127.0.0.1]

TASK: [template src=/dev/null dest=/dev/null] ********************************* 
fatal: [127.0.0.1] => an unexpected type error occurred. Error was Undefined is not JSON serializable

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/redacted/playbook.retry

127.0.0.1                  : ok=1    changed=0    unreachable=1    failed=0   
@jscheid
Copy link
Author

jscheid commented Nov 29, 2014

To clarify, this issue is also present in 1.8.1 and current HEAD (34ec877)

@jimi-c jimi-c added P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed bug_report labels Dec 1, 2014
@jimi-c jimi-c closed this as completed in e61e8a3 Dec 1, 2014
@jimi-c
Copy link
Member

jimi-c commented Dec 1, 2014

Closing This Ticket

Hi!

We believe the above commit should resolve this problem for you. This will also be included in the next major release.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved.

Thank you!

@jscheid
Copy link
Author

jscheid commented Dec 1, 2014

Hi, and thanks for the quick fix. Unfortunately, while it does fix the test case I had put together for this, our playbook is still broken with latest HEAD. I've submitted a new issue at #9684. Thanks again!

jimi-c added a commit that referenced this issue Dec 4, 2014
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed
Projects
None yet
Development

No branches or pull requests

3 participants