Ansible not allowing environment at playbook level

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

I'm having issues defining environment variables at playbook level. According to the docs it should be possible.

$ ansible --version 1.7.1  $ ansible-playbook -i staging deploy.yml ERROR: environment is not a legal parameter at this level in an Ansible Playbook 

Here's the playbook simplified:

--- - hosts: app   user: web    environment:     PATH: "{{ path_append }}:{{ ansible_env.PATH }}"    tasks:     - ...     - ... 

Just to make sure, I tried setting it without the variables, and the result was equal.

Moving the environment-definition inside the tasks works.

回答1:

The doc was incorrect. It was a bug which was fixed in a later version (ansible 1.8). Can you upgrade to 1.9.x?

Enable environment keyword at play level



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!