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

Roles breaking change: role parameter from later invocation stomps on default value from earlier invocation #12460

Closed
marcind opened this issue Sep 22, 2015 · 1 comment
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Milestone

Comments

@marcind
Copy link
Contributor

marcind commented Sep 22, 2015

I ran into the following issue when upgrading from 1.9 to latest devel. Here's a simple repro:

roles\dep\defaults\main.yml


---
my_default_var: from defaults

roles\dep\tasks\main.yml


---
- debug: var=my_default_var

playbook.yml


---
- hosts: all
  gather_facts: false
  roles:
  - role: dep
  - role: dep
    my_default_var: from invocation

This is the output I get running on 1.9

PLAY ************************************************************************** 

TASK: [dep | debug var=my_default_var] **************************************** 
ok: [MYHOST] => {
    "var": {
        "my_default_var": "from defaults"
    }
}

TASK: [dep | debug var=my_default_var] **************************************** 
ok: [MYHOST] => {
    "var": {
        "my_default_var": "from invocation"
    }
}

And here's what happens when I run on 2.0

PLAY ***************************************************************************

TASK [dep : debug var=my_default_var] ******************************************
ok: [MYHOST] => {
    "changed": false,
    "my_default_var": "from invocation"
}

TASK [dep : debug var=my_default_var] ******************************************
ok: [MYHOST] => {
    "changed": false,
    "my_default_var": "from invocation"
}

Notice that in 2.0 there appears to be a change to the variable evaluation order whereby a value gets assigned before the logical order of execution should even put it in scope.

@marcind marcind changed the title Roles breaking change: invocation from later invocation stomps on default value from earlier invocation Roles breaking change: role parameter from later invocation stomps on default value from earlier invocation Sep 22, 2015
@jimi-c jimi-c added bug_report P2 Priority 2 - Issue Blocks Release labels Sep 22, 2015
@jimi-c jimi-c added this to the v2 milestone Sep 22, 2015
@jimi-c jimi-c closed this as completed in a22f7b8 Sep 22, 2015
@jimi-c
Copy link
Member

jimi-c commented Sep 22, 2015

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!

@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. P2 Priority 2 - Issue Blocks Release
Projects
None yet
Development

No branches or pull requests

3 participants