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.