-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Unable to define path variable in playbook #14959
Comments
try with this patch:
|
Doesn't seem to make a difference for me. I'm on Centos and installed via epel yum package (/usr/lib/python2.6/site-packages/ansible/module_utils/basic.py) and pip (/usr/lib/python2.7/site-packages/ansible/module_utils/basic.py) on different systems. I made the patch to both and neither behaved differently using the test play I posted above. I can't find anywhere else I could patch this so I'm guessing that's correct? |
If it's not just me patching incorrectly then I've found out some more info. I changed the test play to the following (with or without the patch it's the same):
and get this result from the debug output
The path is set to what I set in the play and nothing else. It's never going to find the yum binary if that's the case, so somehow this error is also masking some sort of file not found error (or that error is just not implemented for yum). The suggested work around posted in #14655 of using a zero initialised ansible_env.PATH clearly doesn't work. By changing the logic of the setup module to allow definition of environment variables and by forcing us to specify a default initialisation of the ansible_env.PATH variable if we want a non default it's breaking the default initialisation. This is clearly a bug. Either the setup task needs to define facts before looking at the environment section of the play or perhaps this was just not a good change to make in the first place. |
same issue here, using This workaround fixed that for me: |
@yoshiwaan Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information. Here are the items we could not find in your description:
Please set the description of this issue with this template: |
this was fixed via df5895e |
@bcoca, looks like using {{ ansible_env.PATH }} erases everything else from PATH as of v2.3.1.0 - name: Echo path
shell: echo $PATH
environment:
PATH: "/test:{{ ansible_env.PATH }}" Results in Whereas - name: Echo path
shell: echo $PATH
environment:
PATH: "/test" Results in |
@PickRelated I was experiencing the same problem. The reason was that I have the |
Issue Type:
Bug Report
Ansible Version:
Ansible Configuration:
Nothing
Environment:
CentOS 6.7 on Vagrant
Summary:
On previous versions of Ansible I would use a statement like the following in a playbook to define a global path change for a playbook run.
In Ansible 2.0.1.0 this behaviour broke, which is supposedly 'working as intended' according to #14655.
Using the suggested fix from #14655 I changed my statement to:
Which is supposed to create a default initilisation of the variable if it's unset, so that things don't break in the setup task. However this causes issue for other modules, like yum.
Steps To Reproduce:
On a Centos or RHEL box:
testplay.yml
Then run
sudo ansible-playbook -vvvv testplay.yml
If you comment out the PATH line then the play works.
Expected Results:
The yum module would run and update packages
Actual Results:
Any time the yum module invokes yum to install or upgrade a module I get this error with the suggested PATH settings above (if the current state of the yum package is correct then there's no error)
The text was updated successfully, but these errors were encountered: