diff options
author | Scott Weiss <sdw35@cornell.edu> | 2017-08-03 12:21:07 -0400 |
---|---|---|
committer | Scott Weiss <sdw35@cornell.edu> | 2017-08-03 15:18:56 -0400 |
commit | 596abe006140c2a1bd125aca11754ed3b7ba548d (patch) | |
tree | 37ca88dbd95d98b01fcd8d743eb4d9d9eae1b2a9 /roles | |
parent | 05a9c91735cc95457411dbb19951341e5418df18 (diff) | |
download | openshift-596abe006140c2a1bd125aca11754ed3b7ba548d.tar.gz openshift-596abe006140c2a1bd125aca11754ed3b7ba548d.tar.bz2 openshift-596abe006140c2a1bd125aca11754ed3b7ba548d.tar.xz openshift-596abe006140c2a1bd125aca11754ed3b7ba548d.zip |
nfs only run if cloud_provider not defined
Diffstat (limited to 'roles')
-rw-r--r-- | roles/openshift_cfme/tasks/main.yml | 44 | ||||
-rw-r--r-- | roles/openshift_cfme/tasks/nfs.yml | 44 | ||||
-rw-r--r-- | roles/openshift_cfme/tasks/uninstall.yml | 3 |
3 files changed, 50 insertions, 41 deletions
diff --git a/roles/openshift_cfme/tasks/main.yml b/roles/openshift_cfme/tasks/main.yml index 3325ee4a7..74ae16d91 100644 --- a/roles/openshift_cfme/tasks/main.yml +++ b/roles/openshift_cfme/tasks/main.yml @@ -24,48 +24,10 @@ ###################################################################### # NFS +# In the case that we are not running on a cloud provider, volumes must be statically provisioned -- name: Ensure the /exports/ directory exists - file: - path: /exports/ - state: directory - mode: 0755 - owner: root - group: root - -- name: Ensure the miq-pv0X export directories exist - file: - path: "/exports/{{ item }}" - state: directory - mode: 0775 - owner: root - group: root - with_items: "{{ openshift_cfme_pv_exports }}" - -- name: Ensure the NFS exports for CFME PVs exist - copy: - src: openshift_cfme.exports - dest: /etc/exports.d/openshift_cfme.exports - register: nfs_exports_updated - -- name: Ensure the NFS export table is refreshed if exports were added - command: exportfs -ar - when: - - nfs_exports_updated.changed - - -###################################################################### -# Create the required CFME PVs. Check out these online docs if you -# need a refresher on includes looping with items: -# * http://docs.ansible.com/ansible/playbooks_loops.html#loops-and-includes-in-2-0 -# * http://stackoverflow.com/a/35128533 -# -# TODO: Handle the case where a PV template is updated in -# openshift-ansible and the change needs to be landed on the managed -# cluster. - -- include: create_pvs.yml - with_items: "{{ openshift_cfme_pv_data }}" +- include: nfs.yml + when: not (openshift_cloudprovider_kind is defined and (openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce')) ###################################################################### # CFME App Template diff --git a/roles/openshift_cfme/tasks/nfs.yml b/roles/openshift_cfme/tasks/nfs.yml new file mode 100644 index 000000000..8db45492e --- /dev/null +++ b/roles/openshift_cfme/tasks/nfs.yml @@ -0,0 +1,44 @@ +--- +# Tasks to statically provision NFS volumes +# Include if not using dynamic volume provisioning +- name: Ensure the /exports/ directory exists + file: + path: /exports/ + state: directory + mode: 0755 + owner: root + group: root + +- name: Ensure the miq-pv0X export directories exist + file: + path: "/exports/{{ item }}" + state: directory + mode: 0775 + owner: root + group: root + with_items: "{{ openshift_cfme_pv_exports }}" + +- name: Ensure the NFS exports for CFME PVs exist + copy: + src: openshift_cfme.exports + dest: /etc/exports.d/openshift_cfme.exports + register: nfs_exports_updated + +- name: Ensure the NFS export table is refreshed if exports were added + command: exportfs -ar + when: + - nfs_exports_updated.changed + + +###################################################################### +# Create the required CFME PVs. Check out these online docs if you +# need a refresher on includes looping with items: +# * http://docs.ansible.com/ansible/playbooks_loops.html#loops-and-includes-in-2-0 +# * http://stackoverflow.com/a/35128533 +# +# TODO: Handle the case where a PV template is updated in +# openshift-ansible and the change needs to be landed on the managed +# cluster. + +- include: create_pvs.yml + with_items: "{{ openshift_cfme_pv_data }}" diff --git a/roles/openshift_cfme/tasks/uninstall.yml b/roles/openshift_cfme/tasks/uninstall.yml index cba734a0e..406b59364 100644 --- a/roles/openshift_cfme/tasks/uninstall.yml +++ b/roles/openshift_cfme/tasks/uninstall.yml @@ -25,6 +25,7 @@ kind: pv name: "{{ item }}" with_items: "{{ openshift_cfme_pv_exports }}" + when: not (openshift_cloudprovider_kind is defined and (openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce')) - name: Ensure the CFME user is removed oc_user: @@ -36,8 +37,10 @@ path: /etc/exports.d/openshift_cfme.exports state: absent register: nfs_exports_removed + when: not (openshift_cloudprovider_kind is defined and (openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce')) - name: Ensure the NFS export table is refreshed if exports were removed command: exportfs -ar when: - nfs_exports_removed.changed + - not (openshift_cloudprovider_kind is defined and (openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce')) |