diff --git a/defaults/main.yml b/defaults/main.yml index 71f61f3..6d46c29 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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/" diff --git a/meta/main.yml b/meta/main.yml index 034c1c2..0546b93 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -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 diff --git a/tasks/configure.yml b/tasks/configure.yml index fb078e1..24a9113 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -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 \ No newline at end of file + - virtualenvwrapper.configuration diff --git a/tasks/install.yml b/tasks/install.yml index b02902b..fc1a78d 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -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 \ No newline at end of file + - virtualenvwrapper.install