Skip to content

Commit

Permalink
[update] Add compatiblity Ansible 2.x + virtualen option installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Łukasz Ciołecki committed Jan 26, 2017
1 parent 9388b5e commit efb4ca9
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 55 deletions.
8 changes: 5 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---

virtualenv_version: 15.10

virtualenvwrapper_version: 4.7

virtualenvwrapper_python: /usr/bin/python
virtualenvwrapper_python: "/usr/bin/python"

virtualenvwrapper_virtualenv: /usr/local/bin/virtualenv
virtualenvwrapper_virtualenv: "/usr/local/bin/virtualenv"

virtualenvwrapper_source: /usr/local/bin/virtualenvwrapper.sh
virtualenvwrapper_source: "/usr/local/bin/virtualenvwrapper.sh"

virtualenvwrapper_home: "{{ lookup('env', 'HOME') }}/.virtualenvs/"

Expand Down
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
galaxy_info:
author: lciolecki
description: "Ansible role install and configure virtualenvwrapper"
min_ansible_version: 1.4
min_ansible_version: 2.0
license: MIT
platforms:
- name: Ubuntu
Expand Down
95 changes: 50 additions & 45 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,71 @@
---

- name: Set workon home path
sudo: yes
lineinfile: >
dest="{{ virtualenvwrapper_shell_file }}"
regexp="export WORKON_HOME"
line="export WORKON_HOME={{ virtualenvwrapper_home }}"
state=present
backup=yes
create=yes
become: yes
action:
module: lineinfile
dest: "{{ virtualenvwrapper_shell_file }}"
regexp: "export WORKON_HOME"
line: "export WORKON_HOME={{ virtualenvwrapper_home }}"
state: present
backup: yes
create: yes
tags:
- virtualenvwrapper
- virtualenvwrapper_configuration
- virtualenvwrapper.configuration

- name: Set project path
sudo: yes
lineinfile: >
dest="{{ virtualenvwrapper_shell_file }}"
regexp="export PROJECT_HOME"
line="export PROJECT_HOME={{ virtualenvwrapper_project }}"
state=present
backup=yes
create=yes
become: yes
action:
module: lineinfile
dest: "{{ virtualenvwrapper_shell_file }}"
regexp: "export PROJECT_HOME"
line: "export PROJECT_HOME={{ virtualenvwrapper_project }}"
state: present
backup: yes
create: yes
tags:
- virtualenvwrapper
- virtualenvwrapper_configuration
- virtualenvwrapper.configuration

- name: Set virtualenvwrapper python path
sudo: yes
lineinfile: >
dest="{{ virtualenvwrapper_shell_file }}"
regexp="export VIRTUALENVWRAPPER_PYTHON"
line="export VIRTUALENVWRAPPER_PYTHON={{ virtualenvwrapper_python }}"
state=present
backup=yes
create=yes
become: yes
action:
module: lineinfile
dest: "{{ virtualenvwrapper_shell_file }}"
regexp: "export VIRTUALENVWRAPPER_PYTHON"
line: "export VIRTUALENVWRAPPER_PYTHON={{ virtualenvwrapper_python }}"
state: present
backup: yes
create: yes
tags:
- virtualenvwrapper
- virtualenvwrapper_configuration
- virtualenvwrapper.configuration

- name: Set virtualenvwrapper path
sudo: yes
lineinfile: >
dest="{{ virtualenvwrapper_shell_file }}"
regexp="export VIRTUALENVWRAPPER_VIRTUALENV"
line="export VIRTUALENVWRAPPER_VIRTUALENV={{ virtualenvwrapper_virtualenv }}"
state=present
backup=yes
create=yes
become: yes
action:
module: lineinfile
dest: "{{ virtualenvwrapper_shell_file }}"
regexp: "export VIRTUALENVWRAPPER_VIRTUALENV"
line: "export VIRTUALENVWRAPPER_VIRTUALENV={{ virtualenvwrapper_virtualenv }}"
state: present
backup: yes
create: yes
tags:
- virtualenvwrapper
- virtualenvwrapper_configuration
- virtualenvwrapper.configuration

- name: Load virtualenvwrapper.sh
sudo: yes
lineinfile: >
dest="{{ virtualenvwrapper_shell_file }}"
regexp="source {{ virtualenvwrapper_source }}"
line="source {{ virtualenvwrapper_source }}"
state=present
backup=yes
create=yes
become: yes
action:
module: lineinfile
dest: "{{ virtualenvwrapper_shell_file }}"
regexp: "source {{ virtualenvwrapper_source }}"
line: "source {{ virtualenvwrapper_source }}"
state: present
backup: yes
create: yes
tags:
- virtualenvwrapper
- virtualenvwrapper_configuration
- virtualenvwrapper.configuration
25 changes: 19 additions & 6 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
---

- name: Install virtualenv
become: yes
action:
module: pip
name: virtualenv
version: "{{ virtualenv_version }}"
state: present
when: virtualenv_version | default(None) != None
tags:
- virtualenvwrapper
- virtualenvwrapper.install

- name: Install virtualenvwrapper
sudo: yes
pip: >
name=virtualenvwrapper
version={{ virtualenvwrapper_version }}
state=present
become: yes
action:
module: pip
name: virtualenvwrapper
version: "{{ virtualenvwrapper_version }}"
state: present
tags:
- virtualenvwrapper
- virtualenvwrapper_installation
- virtualenvwrapper.install

0 comments on commit efb4ca9

Please sign in to comment.