summaryrefslogtreecommitdiffstats
path: root/roles/openshift_management/tasks
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2017-10-19 16:28:53 -0400
committerTim Bielawa <tbielawa@redhat.com>2017-10-20 16:04:39 -0400
commit7d88f8dada9f19dd6b49af9bb539e43aaa15f138 (patch)
tree0711e86d6692bbccecd0b93e5e7742fc6ce0cc83 /roles/openshift_management/tasks
parentf3741a05097f1848d2b3e9a01f03e76a33487e01 (diff)
downloadopenshift-7d88f8dada9f19dd6b49af9bb539e43aaa15f138.tar.gz
openshift-7d88f8dada9f19dd6b49af9bb539e43aaa15f138.tar.bz2
openshift-7d88f8dada9f19dd6b49af9bb539e43aaa15f138.tar.xz
openshift-7d88f8dada9f19dd6b49af9bb539e43aaa15f138.zip
Refactor adding multiple container providers
Diffstat (limited to 'roles/openshift_management/tasks')
-rw-r--r--roles/openshift_management/tasks/add_many_container_providers.yml26
-rw-r--r--roles/openshift_management/tasks/main.yml4
-rw-r--r--roles/openshift_management/tasks/storage/nfs.yml31
-rw-r--r--roles/openshift_management/tasks/storage/nfs_server.yml31
4 files changed, 55 insertions, 37 deletions
diff --git a/roles/openshift_management/tasks/add_many_container_providers.yml b/roles/openshift_management/tasks/add_many_container_providers.yml
index f92c81277..10a1f4c83 100644
--- a/roles/openshift_management/tasks/add_many_container_providers.yml
+++ b/roles/openshift_management/tasks/add_many_container_providers.yml
@@ -1,9 +1,15 @@
---
-- hosts: "{{ groups['masters'][0] }}"
+- hosts: localhost
tasks:
+ - name: Ensure the container provider configuration is defined
+ assert:
+ that: container_providers_config is defined
+ msg: |
+ Error: Must provide providers config path. Fix: Add '-e container_providers_config=/path/to/your/config' to the ansible-playbook command
+
- name: Include providers/management configuration
include_vars:
- file: "{{ openshift_management_many_container_providers_config }}"
+ file: "{{ container_providers_config }}"
- name: Ensure this cluster is a container provider
uri:
@@ -20,8 +26,16 @@
with_items: "{{ container_providers }}"
register: results
- - name: Ensure failed additions are reported for each container provider
+ # TODO: Make this prettier and easier to read
+ - name: Save results
+ copy:
+ dest: /tmp/results.json
+ content: "{{ results.results | to_nice_json }}"
+ # state: present
+ # debug:
+ # var: item.item
+ # with_items: "{{ results.results }}"
+
+ - name: print each result
debug:
- msg: |
- FLOOP {{ item.item.hostname }}
- with_items: "{{ results.results }}"
+ msg: "{{ results.results | oo_filter_container_providers }}"
diff --git a/roles/openshift_management/tasks/main.yml b/roles/openshift_management/tasks/main.yml
index 88290c44d..9be923a57 100644
--- a/roles/openshift_management/tasks/main.yml
+++ b/roles/openshift_management/tasks/main.yml
@@ -22,6 +22,10 @@
######################################################################
# STORAGE - Initialize basic storage class
+- name: Determine the correct NFS host if required
+ include: storage/nfs_server.yml
+ when: openshift_management_storage_class in ['nfs', 'nfs_external']
+
#---------------------------------------------------------------------
# * nfs - set up NFS shares on the first master for a proof of concept
- name: Create required NFS exports for Management app storage
diff --git a/roles/openshift_management/tasks/storage/nfs.yml b/roles/openshift_management/tasks/storage/nfs.yml
index 696808328..94e11137c 100644
--- a/roles/openshift_management/tasks/storage/nfs.yml
+++ b/roles/openshift_management/tasks/storage/nfs.yml
@@ -2,37 +2,6 @@
# Tasks to statically provision NFS volumes
# Include if not using dynamic volume provisioning
-- name: Ensure we save the local NFS server if one is provided
- set_fact:
- openshift_management_nfs_server: "{{ openshift_management_storage_nfs_local_hostname }}"
- when:
- - openshift_management_storage_nfs_local_hostname is defined
- - openshift_management_storage_nfs_local_hostname != False
- - openshift_management_storage_class == "nfs"
-
-- name: Ensure we save the local NFS server
- set_fact:
- openshift_management_nfs_server: "{{ groups['oo_nfs_to_config'].0 }}"
- when:
- - openshift_management_nfs_server is not defined
- - openshift_management_storage_class == "nfs"
-
-- name: Ensure we save the external NFS server
- set_fact:
- openshift_management_nfs_server: "{{ openshift_management_storage_nfs_external_hostname }}"
- when:
- - openshift_management_storage_class == "nfs_external"
-
-- name: Failed NFS server detection
- assert:
- that:
- - openshift_management_nfs_server is defined
- msg: |
- "Unable to detect an NFS server. The 'nfs_external'
- openshift_management_storage_class option requires that you set
- openshift_management_storage_nfs_external_hostname. NFS hosts detected
- for local nfs services: {{ groups['oo_nfs_to_config'] | join(', ') }}"
-
- name: Setting up NFS storage
block:
- name: Include the NFS Setup role tasks
diff --git a/roles/openshift_management/tasks/storage/nfs_server.yml b/roles/openshift_management/tasks/storage/nfs_server.yml
new file mode 100644
index 000000000..96a742c83
--- /dev/null
+++ b/roles/openshift_management/tasks/storage/nfs_server.yml
@@ -0,0 +1,31 @@
+---
+- name: Ensure we save the local NFS server if one is provided
+ set_fact:
+ openshift_management_nfs_server: "{{ openshift_management_storage_nfs_local_hostname }}"
+ when:
+ - openshift_management_storage_nfs_local_hostname is defined
+ - openshift_management_storage_nfs_local_hostname != False
+ - openshift_management_storage_class == "nfs"
+
+- name: Ensure we save the local NFS server
+ set_fact:
+ openshift_management_nfs_server: "{{ groups['oo_nfs_to_config'].0 }}"
+ when:
+ - openshift_management_nfs_server is not defined
+ - openshift_management_storage_class == "nfs"
+
+- name: Ensure we save the external NFS server
+ set_fact:
+ openshift_management_nfs_server: "{{ openshift_management_storage_nfs_external_hostname }}"
+ when:
+ - openshift_management_storage_class == "nfs_external"
+
+- name: Failed NFS server detection
+ assert:
+ that:
+ - openshift_management_nfs_server is defined
+ msg: |
+ "Unable to detect an NFS server. The 'nfs_external'
+ openshift_management_storage_class option requires that you set
+ openshift_management_storage_nfs_external_hostname. NFS hosts detected
+ for local nfs services: {{ groups['oo_nfs_to_config'] | join(', ') }}"