Alternate Python Translator for Alternate Django

I am writing an unoccupied play to deploy a django application. As part of the process, I would like to run a team staticcollect.

The problem is that there are two python interpreters on the remote server, one Python2.6 and one Python2.7, with Python2.6 being standard.

When I run the playbook, it starts using the Python2.6 interpreter, and I need it to work with the Python2.7 interpreter.

Any idea on how this can be achieved?

My play is as follows:

- hosts: xxxxxxxxx
  vars:
    hg_branch:  dmv2
    django_dir: /opt/app/xxxx
    conf_file:  /opt/app/conf/xx_uwsgi.ini
    django_env:
        STATIC_ROOT: /opt/app/serve/static
  remote_user: xxxxxx
  tasks:
  - name: Update the hg repo
    command: chdir=/opt/app/xxxxx  hg pull -u --rev {{hg_branch}}
  - name: Collect static resources
    environment: django_env
    django_manage: command=collectstatic app_path={{django_dir}}
  - name: Restart the django service
    command: touch {{conf_file}}
  - name: check nginx is running
    service: name=nginx state=started
+4
source share
2 answers

/usr/bin/python /usr/bin/python2.6 /usr/bin/python2.7. bash .

- name: Remove python --> python2.6 symlink
  sudo: yes
  command: rm /usr/bin/python

- name: Add python --> python2.7 symlink
  sudo: yes
  command: ln -s /usr/bin/python2.7 /usr/bin/python
0

All Articles