4

I am provisioning a server with a Django Stack via Ansible and getting the app from bitbucket, I am using https://github.com/jcalazan/ansible-django-stack, but I have had to tweak it a bit in order to make it work with a private bitbucket repo.

Now it's authenticating correctly but giving 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?

Thanks

Community
  • 1
  • 1
Alfonso Embid-Desmet
  • 3,561
  • 3
  • 32
  • 45
  • 1
    Since it's supervisor that starts your program, I think it's more a supervisor issue. If you [program] definition, you should use "environement" to set your PYTHONPATH: http://supervisord.org/configuration.html#program-x-section-settings – magnetik May 27 '15 at 06:35

2 Answers2

6

PYTHONPATH is just another environment variable, so you can use the best practices explained in the FAQ. If it's only needed for the one task, it'd look something like:

- name: Restart Supervisor
  supervisorctl: name={{ application_name }} state=restarted
  environment:
      PYTHONPATH: "{{ ansible_env.PYTHONPATH }}:/my/path"
edunham
  • 131
  • 2
  • 5
1

Something changed. I tried this answer above, but doesn't works. After some digging, and trying:

- name: Restart Supervisor
  supervisorctl: name={{ application_name }} state=restarted
  environment:
      PYTHONPATH: "{{ ansible_env.PATH }}:/my/path"

This should be correct answer.

Razikus
  • 146
  • 2
  • 12