I am provisioning a machine using ansible. I managed to install virtualenv and virtualenvwrapper fine on the vm. However, I can\'t seem to create a virtualenv on the vm.
Additionally to @SiggyF's excellent answer, I would like to add: In case that it appears that this ansible task fails, as it happens somehow with me, you can use the failed_when
feature (ansible 1.4+):
- name: Make virtualenv
shell: "./usr/share/virtualenvwrapper/virtualenvwrapper.sh && mkvirtualenv {{ project }} --python={{ python }} --no-site-packages"
args:
executable: /bin/bash
creates: "{{ virtualenv_dir }}/{{ project }}"
register: mkvirtualenv
failed_when: 'mkvirtualenv.changed and "New python executable" not in mkvirtualenv.stdout'