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.
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