From db570ca4fa92560e0ec1b90e1eabe6192f332c61 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Fri, 16 Oct 2015 11:33:28 -0400 Subject: Install storage plugin dependencies --- roles/openshift_node/tasks/main.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 98271c8b3..036196d5e 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -39,6 +39,15 @@ yum: pkg={{ openshift.common.service_type }}-node{{ openshift_version }},tuned-profiles-{{ openshift.common.service_type }}-node{{ openshift_version }} state=present register: node_install_result +# TODO: allow for storage pre-requisites to be optional +- name: Install storage plugin pre-requisites + yum: + pkg: "{{ item }}" + state: installed + with_items: + - glusterfs-fuse + - ceph-common + - name: Install sdn-ovs package yum: pkg={{ openshift.common.service_type }}-sdn-ovs{{ openshift_version }} state=present register: sdn_install_result @@ -124,9 +133,15 @@ notify: - restart docker -- name: Allow NFS access for VMs - seboolean: name=virt_use_nfs state=yes persistent=yes +- name: Set sebooleans to allow storage plugin access from containers + seboolean: + name: "{{ item }}" + state: yes + persistent: yes when: ansible_selinux and ansible_selinux.status == "enabled" + with_items: + - virt_use_nfs + - virt_use_fusefs - name: Start and enable node service: name={{ openshift.common.service_type }}-node enabled=yes state=started -- cgit v1.2.3 From aff1356306adf8d02efe06ccbb322b68bef0995d Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Fri, 23 Oct 2015 14:08:40 -0400 Subject: make storage plugin dependency installation more flexible --- inventory/byo/hosts.example | 4 ++++ roles/openshift_facts/library/openshift_facts.py | 16 ++++++++++++++++ roles/openshift_node/tasks/main.yml | 21 +++------------------ roles/openshift_node/tasks/storage_plugins/ceph.yml | 5 +++++ .../tasks/storage_plugins/glusterfs.yml | 12 ++++++++++++ roles/openshift_node/tasks/storage_plugins/main.yml | 17 +++++++++++++++++ roles/openshift_node/tasks/storage_plugins/nfs.yml | 7 +++++++ 7 files changed, 64 insertions(+), 18 deletions(-) create mode 100644 roles/openshift_node/tasks/storage_plugins/ceph.yml create mode 100644 roles/openshift_node/tasks/storage_plugins/glusterfs.yml create mode 100644 roles/openshift_node/tasks/storage_plugins/main.yml create mode 100644 roles/openshift_node/tasks/storage_plugins/nfs.yml diff --git a/inventory/byo/hosts.example b/inventory/byo/hosts.example index 6b366cf87..67fb8a25e 100644 --- a/inventory/byo/hosts.example +++ b/inventory/byo/hosts.example @@ -75,6 +75,10 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', # default project node selector #osm_default_node_selector='region=primary' +# default storage plugin dependencies to install, by default the ceph and +# glusterfs plugin dependencies will be installed, if available. +#osn_storage_plugin_deps=['ceph','glusterfs'] + # default selectors for router and registry services # openshift_router_selector='region=infra' # openshift_registry_selector='region=infra' diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 3570de693..95ee822a9 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -469,6 +469,21 @@ def set_aggregate_facts(facts): return facts +def set_node_plugin_facts_if_unset(facts): + """ Set Facts for node storage plugin dependencies if not set. + + Args: + facts (dict): existing facts + Returns: + dict: the facts dict updated with the generated storage plugin + dependency facts + """ + if 'node' in facts: + if 'storage_plugin_deps' not in facts['node']: + facts['node']['storage_plugin_deps'] = ['ceph', 'glusterfs'] + + return facts + def set_deployment_facts_if_unset(facts): """ Set Facts that vary based on deployment_type. This currently includes common.service_type, common.config_base, master.registry_url, @@ -814,6 +829,7 @@ class OpenShiftFacts(object): facts = set_identity_providers_if_unset(facts) facts = set_sdn_facts_if_unset(facts) facts = set_deployment_facts_if_unset(facts) + facts = set_node_plugin_facts_if_unset(facts) facts = set_aggregate_facts(facts) return dict(openshift=facts) diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 036196d5e..aea60b75c 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -32,6 +32,7 @@ schedulable: "{{ openshift_schedulable | default(openshift_scheduleable) | default(None) }}" docker_log_driver: "{{ lookup( 'oo_option' , 'docker_log_driver' ) | default('',True) }}" docker_log_options: "{{ lookup( 'oo_option' , 'docker_log_options' ) | default('',True) }}" + storage_plugin_deps: "{{ osn_storage_plugin_deps | default(None) }}" # We have to add tuned-profiles in the same transaction otherwise we run into depsolving # problems because the rpms don't pin the version properly. @@ -39,15 +40,6 @@ yum: pkg={{ openshift.common.service_type }}-node{{ openshift_version }},tuned-profiles-{{ openshift.common.service_type }}-node{{ openshift_version }} state=present register: node_install_result -# TODO: allow for storage pre-requisites to be optional -- name: Install storage plugin pre-requisites - yum: - pkg: "{{ item }}" - state: installed - with_items: - - glusterfs-fuse - - ceph-common - - name: Install sdn-ovs package yum: pkg={{ openshift.common.service_type }}-sdn-ovs{{ openshift_version }} state=present register: sdn_install_result @@ -133,15 +125,8 @@ notify: - restart docker -- name: Set sebooleans to allow storage plugin access from containers - seboolean: - name: "{{ item }}" - state: yes - persistent: yes - when: ansible_selinux and ansible_selinux.status == "enabled" - with_items: - - virt_use_nfs - - virt_use_fusefs +- name: Additional storage plugin configuration + include: storage_plugins/main.yml - name: Start and enable node service: name={{ openshift.common.service_type }}-node enabled=yes state=started diff --git a/roles/openshift_node/tasks/storage_plugins/ceph.yml b/roles/openshift_node/tasks/storage_plugins/ceph.yml new file mode 100644 index 000000000..b6936618a --- /dev/null +++ b/roles/openshift_node/tasks/storage_plugins/ceph.yml @@ -0,0 +1,5 @@ +--- +- name: Install Ceph storage plugin dependencies + yum: + pkg: ceph-common + state: installed diff --git a/roles/openshift_node/tasks/storage_plugins/glusterfs.yml b/roles/openshift_node/tasks/storage_plugins/glusterfs.yml new file mode 100644 index 000000000..b812e81df --- /dev/null +++ b/roles/openshift_node/tasks/storage_plugins/glusterfs.yml @@ -0,0 +1,12 @@ +--- +- name: Install GlusterFS storage plugin dependencies + yum: + pkg: glusterfs-fuse + state: installed + +- name: Set seboolean to allow gluster storage plugin access from containers + seboolean: + name: virt_use_fusefs + state: yes + persistent: yes + when: ansible_selinux and ansible_selinux.status == "enabled" diff --git a/roles/openshift_node/tasks/storage_plugins/main.yml b/roles/openshift_node/tasks/storage_plugins/main.yml new file mode 100644 index 000000000..042b38cd3 --- /dev/null +++ b/roles/openshift_node/tasks/storage_plugins/main.yml @@ -0,0 +1,17 @@ +--- +- pause: + +# The NFS storage plugin is always enabled since it doesn't require any +# additional package dependencies +- name: NFS storage plugin configuration + include: nfs.yml + +- name: GlusterFS storage plugin configuration + include: glusterfs.yml + when: "'glusterfs' in openshift.node.storage_plugin_deps" + +- name: Ceph storage plugin configuration + include: ceph.yml + when: "'ceph' in openshift.node.storage_plugin_deps" + +- pause: diff --git a/roles/openshift_node/tasks/storage_plugins/nfs.yml b/roles/openshift_node/tasks/storage_plugins/nfs.yml new file mode 100644 index 000000000..1edf21d9b --- /dev/null +++ b/roles/openshift_node/tasks/storage_plugins/nfs.yml @@ -0,0 +1,7 @@ +--- +- name: Set seboolean to allow nfs storage plugin access from containers + seboolean: + name: virt_use_nfs + state: yes + persistent: yes + when: ansible_selinux and ansible_selinux.status == "enabled" -- cgit v1.2.3 From 56660d50f1480d6c7ba7b83c4b172084614e6226 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Mon, 26 Oct 2015 22:42:27 -0400 Subject: remove debugging pauses --- roles/openshift_node/tasks/storage_plugins/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/roles/openshift_node/tasks/storage_plugins/main.yml b/roles/openshift_node/tasks/storage_plugins/main.yml index 042b38cd3..39c7b9390 100644 --- a/roles/openshift_node/tasks/storage_plugins/main.yml +++ b/roles/openshift_node/tasks/storage_plugins/main.yml @@ -1,6 +1,4 @@ --- -- pause: - # The NFS storage plugin is always enabled since it doesn't require any # additional package dependencies - name: NFS storage plugin configuration @@ -13,5 +11,3 @@ - name: Ceph storage plugin configuration include: ceph.yml when: "'ceph' in openshift.node.storage_plugin_deps" - -- pause: -- cgit v1.2.3 From 8bfcf17c0355464123146685e31e06a27182b1a9 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Tue, 27 Oct 2015 13:34:53 -0400 Subject: make storage_plugin_deps conditional on deployment_type --- roles/openshift_facts/library/openshift_facts.py | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 95ee822a9..220dce702 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -469,25 +469,10 @@ def set_aggregate_facts(facts): return facts -def set_node_plugin_facts_if_unset(facts): - """ Set Facts for node storage plugin dependencies if not set. - - Args: - facts (dict): existing facts - Returns: - dict: the facts dict updated with the generated storage plugin - dependency facts - """ - if 'node' in facts: - if 'storage_plugin_deps' not in facts['node']: - facts['node']['storage_plugin_deps'] = ['ceph', 'glusterfs'] - - return facts - def set_deployment_facts_if_unset(facts): """ Set Facts that vary based on deployment_type. This currently includes common.service_type, common.config_base, master.registry_url, - node.registry_url + node.registry_url, node.storage_plugin_deps Args: facts (dict): existing facts @@ -529,6 +514,14 @@ def set_deployment_facts_if_unset(facts): registry_url = 'aep3/aep-${component}:${version}' facts[role]['registry_url'] = registry_url + if 'node' in facts: + deployment_type = facts['common']['deployment_type'] + if 'storage_plugin_deps' not in facts['node']: + if deployment_type in ['openshift-enterprise', 'atomic-enterprise']: + facts['node']['storage_plugin_deps'] = ['ceph', 'glusterfs'] + else: + facts['node']['storage_plugin_deps'] = [] + return facts @@ -829,7 +822,6 @@ class OpenShiftFacts(object): facts = set_identity_providers_if_unset(facts) facts = set_sdn_facts_if_unset(facts) facts = set_deployment_facts_if_unset(facts) - facts = set_node_plugin_facts_if_unset(facts) facts = set_aggregate_facts(facts) return dict(openshift=facts) -- cgit v1.2.3