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_vars don't override variables in vars_files #9242

Closed
hkariti opened this issue Oct 2, 2014 · 5 comments
Closed

extra_vars don't override variables in vars_files #9242

hkariti opened this issue Oct 2, 2014 · 5 comments
Labels
bug This issue/PR relates to a bug. needs_info This issue requires further information. Please answer any outstanding questions. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed

Comments

@hkariti
Copy link
Contributor

hkariti commented Oct 2, 2014

Issue Type:

Bug Report

Ansible Version:

ansible 1.8 (devel 43eb821) last updated 2014/10/02 08:44:04 (GMT +000)
lib/ansible/modules/core: (detached HEAD 617a52b) last updated 2014/09/28 12:24:37 (GMT +000)
lib/ansible/modules/extras: (detached HEAD 110250d) last updated 2014/09/28 12:24:41 (GMT +000)
configured module search path = None

Environment:

Ubuntu 12.10

Summary:

Overriding variables with -e doesn't work on variables in vars_files.

Bisecting points to 8a1fbed (again, sorry James :\ )

Steps to reproduce:

var_file:

var: 1

playbook:


---
- hosts: localhost
  gather_facts: no
  vars_files:
    - var_file
  tasks:
    - debug: var=var

command:

ansible-playbook playbook.yml -e var=2
Expected Results:
TASK: [debug var=var] ********************************************************* 
ok: [localhost] => {
    "var": "2"
}
Actual Results:
TASK: [debug var=var] ********************************************************* 
ok: [localhost] => {
    "var": "1"
}
@mpdehaan mpdehaan added P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed bug_report labels Oct 3, 2014
@jimi-c
Copy link
Member

jimi-c commented Oct 3, 2014

Hi @hkariti, I just tried this against devel and it appears fixed:

TASK: [debug var=var] ********************************************************* 
ok: [127.0.0.1] => {
    "var": "2"
}

I even backed up to a commit on Oct. 1st and it still worked, so I'm not quite sure what your issue might be.

@jimi-c jimi-c added the needs_info This issue requires further information. Please answer any outstanding questions. label Oct 3, 2014
@hkariti
Copy link
Contributor Author

hkariti commented Oct 5, 2014

Ok, this is working correctly for me too now. But I still think I'm not crazy. I managed to reproduce it again with the latest dev, but with inventory vars + regular vars and not vars_file:

inventory:

localhost ansible_connection=local
[all:vars]
var=1

playbook:

---
- hosts: localhost
  gather_facts: no
  vars:
    var2: "{{var}}"
  tasks:
    - debug: var=var2
    - debug: var=var

command:

ansible-playbook -i inventory playbook.yml -e var=2

output:


TASK: [debug var=var2] ******************************************************** 
ok: [localhost] => {
    "var2": "1"
}

TASK: [debug var=var] ********************************************************* 
ok: [localhost] => {
    "var": "2"
}

@jimi-c
Copy link
Member

jimi-c commented Oct 6, 2014

Yeah that's an odd one, but should be easy to fix. Looking into this now.

@jimi-c jimi-c closed this as completed in 12d5b75 Oct 6, 2014
@jimi-c
Copy link
Member

jimi-c commented Oct 6, 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!

@hkariti
Copy link
Contributor Author

hkariti commented Oct 6, 2014

Thanks!

abadger added a commit that referenced this issue Nov 26, 2014
abadger added a commit that referenced this issue Nov 27, 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. needs_info This issue requires further information. Please answer any outstanding questions. P1 Priority 1 - Immediate Attention Required; Release Immediately After Fixed
Projects
None yet
Development

No branches or pull requests

4 participants