Change PYTHONPATH via Ansible for a supervisorctl managed Python app
I provide a server with Django Stack via Ansible and get my app from bitbucket, I am using https://github.com/jcalazan/ansible-django-stack but I had to tweak it a bit to get it to work with the private bitbucket repository.
Now it authenticates correctly but gives me the following error
failed: [default] => {"failed": true} msg: youtubeadl: ERROR (not running) youtubeadl: ERROR (abnormal termination)
When performing this task:
- name: Restart Supervisor
supervisorctl: name={{ application_name }} state=restarted
Reading gunicorn ERROR (abnormal termination) , I would like to add the project to the PYTHONPATH, any ideas how to approach this with an Ansible task, or am I missing something?
thank
source to share
PYTHONPATH
is another environment variable, so you can use the best practices described in the FAQ . If it's only needed for one task, it looks something like this:
- name: Restart Supervisor
supervisorctl: name={{ application_name }} state=restarted
environment:
PYTHONPATH: "{{ ansible_env.PYTHONPATH }}:/my/path"
source to share