From 4ef9403aef6df97f01b44e483c5818726b2b75d9 Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Mon, 8 Aug 2016 15:30:13 -0400 Subject: with_fileglob no longer supports wildcard prefixes. --- .../files/fedora-openshift-enterprise/gpg_keys/.gitkeep | 0 .../files/fedora-openshift-enterprise/repos/.gitkeep | 0 .../files/openshift-enterprise/gpg_keys/.gitkeep | 0 .../files/openshift-enterprise/repos/.gitkeep | 0 roles/openshift_repos/tasks/main.yaml | 16 +++++++++++++--- 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 roles/openshift_repos/files/fedora-openshift-enterprise/gpg_keys/.gitkeep create mode 100644 roles/openshift_repos/files/fedora-openshift-enterprise/repos/.gitkeep create mode 100644 roles/openshift_repos/files/openshift-enterprise/gpg_keys/.gitkeep create mode 100644 roles/openshift_repos/files/openshift-enterprise/repos/.gitkeep (limited to 'roles') diff --git a/roles/openshift_repos/files/fedora-openshift-enterprise/gpg_keys/.gitkeep b/roles/openshift_repos/files/fedora-openshift-enterprise/gpg_keys/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/roles/openshift_repos/files/fedora-openshift-enterprise/repos/.gitkeep b/roles/openshift_repos/files/fedora-openshift-enterprise/repos/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/roles/openshift_repos/files/openshift-enterprise/gpg_keys/.gitkeep b/roles/openshift_repos/files/openshift-enterprise/gpg_keys/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/roles/openshift_repos/files/openshift-enterprise/repos/.gitkeep b/roles/openshift_repos/files/openshift-enterprise/repos/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/roles/openshift_repos/tasks/main.yaml b/roles/openshift_repos/tasks/main.yaml index d8e43438a..07a8d28fd 100644 --- a/roles/openshift_repos/tasks/main.yaml +++ b/roles/openshift_repos/tasks/main.yaml @@ -34,7 +34,12 @@ path: "/etc/yum.repos.d/{{ item | basename }}" state: absent with_fileglob: - - '*/repos/*' + - "fedora-openshift-enterprise/repos/*" + - "fedora-origin/repos/*" + - "online/repos/*" + - "openshift-enterprise/repos/*" + - "origin/repos/*" + - "removed/repos/*" when: not openshift.common.is_containerized | bool and not (item | search("/files/" ~ openshift_deployment_type ~ "/repos")) and (ansible_os_family == "RedHat" and ansible_distribution != "Fedora") @@ -42,10 +47,15 @@ - name: Remove any yum repo files for other deployment types Fedora file: - path: "/etc/yum.repos.d/{{ item | basename }}" + path: "{{ item | basename }}" state: absent with_fileglob: - - '*/repos/*' + - "fedora-openshift-enterprise/repos/*" + - "fedora-origin/repos/*" + - "online/repos/*" + - "openshift-enterprise/repos/*" + - "origin/repos/*" + - "removed/repos/*" when: not openshift.common.is_containerized | bool and not (item | search("/files/fedora-" ~ openshift_deployment_type ~ "/repos")) and (ansible_distribution == "Fedora") -- cgit v1.2.3 From 9b0d793eadddf290388239b167cdf83142a36c78 Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Mon, 8 Aug 2016 15:31:08 -0400 Subject: Try/except urlparse calls. --- roles/openshift_facts/library/openshift_facts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 659f4eba6..afa2626f9 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -944,7 +944,11 @@ def format_url(use_ssl, hostname, port, path=''): netloc = hostname if (use_ssl and port != '443') or (not use_ssl and port != '80'): netloc += ":%s" % port - return urlparse.urlunparse((scheme, netloc, path, '', '', '')) + try: + url = urlparse.urlunparse((scheme, netloc, path, '', '', '')) + except AttributeError: + url = urlunparse((scheme, netloc, path, '', '', '')) + return url def get_current_config(facts): """ Get current openshift config -- cgit v1.2.3 From 6d34ffd8e302028fab9316fe45aa537dc6434e5c Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Thu, 4 Aug 2016 11:22:41 -0400 Subject: Support gathering ansible 2.1/2.2 system facts --- roles/openshift_facts/library/openshift_facts.py | 31 +++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index afa2626f9..8c416e88d 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -947,6 +947,7 @@ def format_url(use_ssl, hostname, port, path=''): try: url = urlparse.urlunparse((scheme, netloc, path, '', '', '')) except AttributeError: + # pylint: disable=undefined-variable url = urlunparse((scheme, netloc, path, '', '', '')) return url @@ -1603,11 +1604,13 @@ class OpenShiftFacts(object): try: # ansible-2.1 - # pylint: disable=too-many-function-args + # pylint: disable=too-many-function-args,invalid-name self.system_facts = ansible_facts(module, ['hardware', 'network', 'virtual', 'facter']) - except TypeError: - # ansible-1.9.x,ansible-2.0.x - self.system_facts = ansible_facts(module) + for (k, v) in self.system_facts.items(): + self.system_facts["ansible_%s" % k.replace('-', '_')] = v + except UnboundLocalError: + # ansible-2.2 + self.system_facts = get_all_facts(module)['ansible_facts'] self.facts = self.generate_facts(local_facts, additive_facts_to_overwrite, @@ -1688,11 +1691,11 @@ class OpenShiftFacts(object): dict: The generated default facts """ defaults = {} - ip_addr = self.system_facts['default_ipv4']['address'] + ip_addr = self.system_facts['ansible_default_ipv4']['address'] exit_code, output, _ = module.run_command(['hostname', '-f']) hostname_f = output.strip() if exit_code == 0 else '' - hostname_values = [hostname_f, self.system_facts['nodename'], - self.system_facts['fqdn']] + hostname_values = [hostname_f, self.system_facts['ansible_nodename'], + self.system_facts['ansible_fqdn']] hostname = choose_hostname(hostname_values, ip_addr) defaults['common'] = dict(use_openshift_sdn=True, ip=ip_addr, @@ -1825,10 +1828,10 @@ class OpenShiftFacts(object): dict: The generated default facts for the detected provider """ # TODO: cloud provider facts should probably be submitted upstream - product_name = self.system_facts['product_name'] - product_version = self.system_facts['product_version'] - virt_type = self.system_facts['virtualization_type'] - virt_role = self.system_facts['virtualization_role'] + product_name = self.system_facts['ansible_product_name'] + product_version = self.system_facts['ansible_product_version'] + virt_type = self.system_facts['ansible_virtualization_type'] + virt_role = self.system_facts['ansible_virtualization_role'] provider = None metadata = None @@ -2111,12 +2114,16 @@ def main(): additive_facts_to_overwrite=dict(default=[], type='list', required=False), openshift_env=dict(default={}, type='dict', required=False), openshift_env_structures=dict(default=[], type='list', required=False), - protected_facts_to_overwrite=dict(default=[], type='list', required=False), + protected_facts_to_overwrite=dict(default=[], type='list', required=False) ), supports_check_mode=True, add_file_common_args=True, ) + module.params['gather_subset'] = ['hardware', 'network', 'virtual', 'facter'] + module.params['gather_timeout'] = 10 + module.params['filter'] = '*' + role = module.params['role'] local_facts = module.params['local_facts'] additive_facts_to_overwrite = module.params['additive_facts_to_overwrite'] -- cgit v1.2.3 From af64e08020e94566f27e4f44b48d485b37b236c1 Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Thu, 4 Aug 2016 15:00:46 -0400 Subject: Move storage includes up to main. --- roles/openshift_hosted/tasks/registry/registry.yml | 2 ++ roles/openshift_node/tasks/main.yml | 16 ++++++++++++++-- roles/openshift_node/tasks/storage_plugins/main.yml | 17 ----------------- 3 files changed, 16 insertions(+), 19 deletions(-) delete mode 100644 roles/openshift_node/tasks/storage_plugins/main.yml (limited to 'roles') diff --git a/roles/openshift_hosted/tasks/registry/registry.yml b/roles/openshift_hosted/tasks/registry/registry.yml index fc037ceda..b28974236 100644 --- a/roles/openshift_hosted/tasks/registry/registry.yml +++ b/roles/openshift_hosted/tasks/registry/registry.yml @@ -50,7 +50,9 @@ when: replicas | int > 0 - include: storage/object_storage.yml + static: no when: replicas | int > 0 and openshift.hosted.registry.storage.kind | default(none) == 'object' - include: storage/persistent_volume.yml + static: no when: replicas | int > 0 and openshift.hosted.registry.storage.kind | default(none) in ['nfs', 'openstack'] diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 889541e25..9c71af6d9 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -106,8 +106,20 @@ notify: - restart node -- name: Additional storage plugin configuration - include: storage_plugins/main.yml +- name: NFS storage plugin configuration + include: storage_plugins/nfs.yml + +- name: GlusterFS storage plugin configuration + include: storage_plugins/glusterfs.yml + when: "'glusterfs' in openshift.node.storage_plugin_deps" + +- name: Ceph storage plugin configuration + include: storage_plugins/ceph.yml + when: "'ceph' in openshift.node.storage_plugin_deps" + +- name: iSCSI storage plugin configuration + include: storage_plugins/iscsi.yml + when: "'iscsi' in openshift.node.storage_plugin_deps" # Necessary because when you're on a node that's also a master the master will be # restarted after the node restarts docker and it will take up to 60 seconds for diff --git a/roles/openshift_node/tasks/storage_plugins/main.yml b/roles/openshift_node/tasks/storage_plugins/main.yml deleted file mode 100644 index fe638718d..000000000 --- a/roles/openshift_node/tasks/storage_plugins/main.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# 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" - -- name: iSCSI storage plugin configuration - include: iscsi.yml - when: "'iscsi' in openshift.node.storage_plugin_deps" -- cgit v1.2.3