Add nodepool_task_manager to expose control of tasks

There might be a time were we only want run the pre task, so rather
then copying the code into another modules, just allow the user to
override the task list that runs.

Change-Id: I15f58454607c5c56f9bb092036a656618b6b3c20
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-09-03 22:02:09 -04:00
parent bfe2244040
commit 7d719fe355
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
6 changed files with 21 additions and 9 deletions

View File

@ -12,6 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
--- ---
# tasks/main.yaml
nodepool_task_manager:
- pre
- install
- config
- service
# tasks/config.yaml # tasks/config.yaml
nodepool_user_name: nodepool nodepool_user_name: nodepool
nodepool_user_group: nodepool nodepool_user_group: nodepool

View File

@ -18,6 +18,7 @@
when: nodepool_build_depends is not defined when: nodepool_build_depends is not defined
- name: Ensure build dependencies are installed - name: Ensure build dependencies are installed
become: yes
package: package:
name: "{{ item }}" name: "{{ item }}"
state: installed state: installed

View File

@ -13,12 +13,14 @@
# under the License. # under the License.
--- ---
- name: Git clone nodepool. - name: Git clone nodepool.
become: yes
git: git:
dest: "{{ nodepool_git_dest }}" dest: "{{ nodepool_git_dest }}"
repo: "{{ nodepool_git_uri }}" repo: "{{ nodepool_git_uri }}"
version: "{{ nodepool_git_version }}" version: "{{ nodepool_git_version }}"
- name: Pip install nodepool from local git repo. - name: Pip install nodepool from local git repo.
become: yes
pip: pip:
extra_args: "{{ nodepool_pip_extra_args|default(omit) }}" extra_args: "{{ nodepool_pip_extra_args|default(omit) }}"
name: "file://{{ nodepool_git_dest }}" name: "file://{{ nodepool_git_dest }}"

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
--- ---
- name: Install nodepool using pip. - name: Install nodepool using pip.
become: yes
pip: pip:
extra_args: "{{ nodepool_pip_extra_args|default(omit) }}" extra_args: "{{ nodepool_pip_extra_args|default(omit) }}"
name: "{{ nodepool_pip_name }}" name: "{{ nodepool_pip_name }}"

View File

@ -15,12 +15,7 @@
- name: Include OS-specific variables. - name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yaml" include_vars: "{{ ansible_os_family }}.yaml"
- include: pre.yaml - include: "{{ nodepool_task }}.yaml"
with_items: "{{ nodepool_task_manager }}"
- include: install.yaml loop_control:
become: yes loop_var: nodepool_task
- include: config.yaml
- include: service.yaml
become: yes

View File

@ -73,6 +73,7 @@
when: nodepool_file_nodepool_builder_service_config_src is not defined when: nodepool_file_nodepool_builder_service_config_src is not defined
- name: Copy nodepool services scripts into place. - name: Copy nodepool services scripts into place.
become: yes
copy: copy:
dest: "{{ nodepool_file_nodepool_service_dest }}" dest: "{{ nodepool_file_nodepool_service_dest }}"
group: "{{ nodepool_file_nodepool_service_group }}" group: "{{ nodepool_file_nodepool_service_group }}"
@ -81,6 +82,7 @@
src: "{{ nodepool_file_nodepool_service_src }}" src: "{{ nodepool_file_nodepool_service_src }}"
- name: Copy nodepool service config into place. - name: Copy nodepool service config into place.
become: yes
copy: copy:
dest: "{{ nodepool_file_nodepool_service_config_dest }}" dest: "{{ nodepool_file_nodepool_service_config_dest }}"
group: "{{ nodepool_file_nodepool_service_config_group }}" group: "{{ nodepool_file_nodepool_service_config_group }}"
@ -89,6 +91,7 @@
src: "{{ nodepool_file_nodepool_service_config_src }}" src: "{{ nodepool_file_nodepool_service_config_src }}"
- name: Copy nodepool-builder services scripts into place. - name: Copy nodepool-builder services scripts into place.
become: yes
copy: copy:
dest: "{{ nodepool_file_nodepool_builder_service_dest }}" dest: "{{ nodepool_file_nodepool_builder_service_dest }}"
group: "{{ nodepool_file_nodepool_builder_service_group }}" group: "{{ nodepool_file_nodepool_builder_service_group }}"
@ -97,6 +100,7 @@
src: "{{ nodepool_file_nodepool_builder_service_src }}" src: "{{ nodepool_file_nodepool_builder_service_src }}"
- name: Copy nodepool service config into place. - name: Copy nodepool service config into place.
become: yes
copy: copy:
dest: "{{ nodepool_file_nodepool_builder_service_config_dest }}" dest: "{{ nodepool_file_nodepool_builder_service_config_dest }}"
group: "{{ nodepool_file_nodepool_builder_service_config_group }}" group: "{{ nodepool_file_nodepool_builder_service_config_group }}"
@ -105,6 +109,7 @@
src: "{{ nodepool_file_nodepool_builder_service_config_src }}" src: "{{ nodepool_file_nodepool_builder_service_config_src }}"
- name: Enable nodepool service. - name: Enable nodepool service.
become: yes
service: service:
enabled: "{{ nodepool_service_nodepool_enabled }}" enabled: "{{ nodepool_service_nodepool_enabled }}"
name: "{{ nodepool_service_nodepool_name }}" name: "{{ nodepool_service_nodepool_name }}"
@ -112,6 +117,7 @@
when: nodepool_service_nodepool_manage when: nodepool_service_nodepool_manage
- name: Enable nodepool-builder service. - name: Enable nodepool-builder service.
become: yes
service: service:
enabled: "{{ nodepool_service_nodepool_builder_enabled }}" enabled: "{{ nodepool_service_nodepool_builder_enabled }}"
name: "{{ nodepool_service_nodepool_builder_name }}" name: "{{ nodepool_service_nodepool_builder_name }}"