-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Text backups (xxx.yml~) in host_vars override variables #11017
Comments
|
Could you add a link to the code you are referring to? Thanks |
Let's do the math together. Let
then
Now Then |
ah, yes, you did not mention it was a folder, if using a folder for group Brian Coca |
Is that desired? Does a user need/want to parse Assuming it is desired that all files in a host's host_vars are parsed as variables, one could argue about what a hidden file is on Linux. Nautilus on Ubuntu for example does not display text backup files ending on ~ while |
When loading vars from a dir, only hidden file or subdirs are skipped (https://github.com/ansible/ansible/blob/devel/lib/ansible/utils/__init__.py#L1619-L1620) When checking the base paths to load files from, https://github.com/ansible/ansible/blob/devel/lib/ansible/utils/__init__.py#L1521, So that check should also happen when scanning a dirctory at https://github.com/ansible/ansible/blob/devel/lib/ansible/utils/__init__.py#L1619-L1620 @bcoca you marked this issues a a bug_report, so I assume such a fix is acceptable? |
@svg, considering it, want to sync with rest of core before deciding |
inventory vars: make loading from a directory obey the same rules as when checking the base paths, looking at the file name extensions as defined in CONSTANTS.YAML_FILENAME_EXTENSIONS Fixes Github issue ansible#11017
Could you reopen this? I'm experiencing the same problem on ansible 2.0.1.0 Reproducing:
|
Same here in ansible 2.1.1 |
Reproducible consistently with 2.2.0.0. Debugging the cause of failure in a large playbook just took me an hour because of this bug. @opqdonut's test case is minimal and reproduces the issue every time, so fixing should be simple. Please re-open the issue. Thank you. |
Confirmed with 2.2.1.0, potentially super-dangerous bug. Basically, my structure is following:
Similarly, for staging environment (and production)
Now, Ansible picked values from Emacs temporary file
You can clearly envision how this can potentially cause catastrophic situations. |
Confirmed with 2.2.2.0, This bug is pretty problematic. I think it is currently tracked as issue 17382 and there is an open PR. |
Issue Type:
Bug Report
Ansible Version:
ansible 1.9.1 from ppa:ansible/ansible
Ansible Configuration:
default
Environment:
Ubuntu 15.04
Summary:
Text backup files ending on tilde as created e.g. by joe or gedit, in
host_vars/<hostname>/
override the actual variable data.Steps To Reproduce:
host_vars/<hostname>/test.yml
host_vars/<hostname>/test.yml
using gedit, gedit will createhost_vars/<hostname>/test.yml~
test.yml
andtest.yml~
differNow ansible will override a variable defined in
test.yml
using the data fromtest.yml~
.Expected Results:
Only
*.yml
files are recognized by ansible inhost_vars
.Actual Results:
*.yml~
files are recognized by ansible inhost_vars
.The text was updated successfully, but these errors were encountered: