Rework install task

Break out install.yaml into sub files to reduce conditional logic.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-08-28 21:26:54 -04:00
parent 16fffcdcbc
commit 0b774829e2
3 changed files with 27 additions and 23 deletions

View File

@ -12,30 +12,13 @@
- include: install/debian.yaml
when: ansible_os_family == 'Debian'
- name: Download nodepool using git.
git:
dest: "{{ nodepool_git_dest }}"
repo: "{{ nodepool_git_uri }}"
version: "{{ nodepool_git_version }}"
- include: install/git.yaml
when: nodepool_install_method == 'git'
- name: Install nodepool using pip.
pip:
name: "file://{{ nodepool_git_dest }}"
when: nodepool_install_method == 'git'
- name: Install nodepool using pip.
pip:
name: nodepool
- include: install/pip.yaml
when: nodepool_install_method == 'pip'
- name: Install nodepool using pip.
pip:
name: nodepool
when: nodepool_install_method == 'pip' and nodepool_pip_version is none
- name: Install nodepool using pip.
pip:
name: nodepool
version: "{{ nodepool_pip_version }}"
when: nodepool_install_method == 'pip' and nodepool_pip_version is not none
- name: Create nodepool directory.
file:
path: /etc/nodepool
state: directory

10
tasks/install/git.yaml Normal file
View File

@ -0,0 +1,10 @@
---
- name: Git clone nodepool.
git:
dest: "{{ nodepool_git_dest }}"
repo: "{{ nodepool_git_uri }}"
version: "{{ nodepool_git_version }}"
- name: Pip install nodepool from local git repo.
pip:
name: "file://{{ nodepool_git_dest }}"

11
tasks/install/pip.yaml Normal file
View File

@ -0,0 +1,11 @@
---
- name: Install nodepool using pip.
pip:
name: nodepool
when: nodepool_pip_version is none
- name: Install nodepool using pip.
pip:
name: nodepool
version: "{{ nodepool_pip_version }}"
when: nodepool_pip_version is not none