summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_facts')
-rw-r--r--roles/openshift_facts/defaults/main.yml2
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py104
-rw-r--r--roles/openshift_facts/meta/main.yml3
-rw-r--r--roles/openshift_facts/tasks/main.yml116
-rw-r--r--roles/openshift_facts/vars/Fedora.yml6
-rw-r--r--roles/openshift_facts/vars/default.yml6
-rw-r--r--roles/openshift_facts/vars/main.yml5
7 files changed, 30 insertions, 212 deletions
diff --git a/roles/openshift_facts/defaults/main.yml b/roles/openshift_facts/defaults/main.yml
deleted file mode 100644
index cc4dc9365..000000000
--- a/roles/openshift_facts/defaults/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-openshift_use_system_containers: false
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index beef77896..844d77255 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -915,6 +915,7 @@ def set_version_facts_if_unset(facts):
version_gte_3_4_or_1_4 = version >= LooseVersion('1.4')
version_gte_3_5_or_1_5 = version >= LooseVersion('1.5')
version_gte_3_6 = version >= LooseVersion('3.6')
+ version_gte_3_7 = version >= LooseVersion('3.7')
else:
version_gte_3_1_or_1_1 = version >= LooseVersion('3.0.2.905')
version_gte_3_1_1_or_1_1_1 = version >= LooseVersion('3.1.1')
@@ -923,6 +924,7 @@ def set_version_facts_if_unset(facts):
version_gte_3_4_or_1_4 = version >= LooseVersion('3.4')
version_gte_3_5_or_1_5 = version >= LooseVersion('3.5')
version_gte_3_6 = version >= LooseVersion('3.6')
+ version_gte_3_7 = version >= LooseVersion('3.7')
else:
# 'Latest' version is set to True, 'Next' versions set to False
version_gte_3_1_or_1_1 = True
@@ -932,6 +934,7 @@ def set_version_facts_if_unset(facts):
version_gte_3_4_or_1_4 = True
version_gte_3_5_or_1_5 = True
version_gte_3_6 = True
+ version_gte_3_7 = False
facts['common']['version_gte_3_1_or_1_1'] = version_gte_3_1_or_1_1
facts['common']['version_gte_3_1_1_or_1_1_1'] = version_gte_3_1_1_or_1_1_1
facts['common']['version_gte_3_2_or_1_2'] = version_gte_3_2_or_1_2
@@ -939,8 +942,11 @@ def set_version_facts_if_unset(facts):
facts['common']['version_gte_3_4_or_1_4'] = version_gte_3_4_or_1_4
facts['common']['version_gte_3_5_or_1_5'] = version_gte_3_5_or_1_5
facts['common']['version_gte_3_6'] = version_gte_3_6
+ facts['common']['version_gte_3_7'] = version_gte_3_7
- if version_gte_3_6:
+ if version_gte_3_7:
+ examples_content_version = 'v3.7'
+ elif version_gte_3_6:
examples_content_version = 'v3.6'
elif version_gte_3_5_or_1_5:
examples_content_version = 'v1.5'
@@ -1642,75 +1648,27 @@ def set_proxy_facts(facts):
"""
if 'common' in facts:
common = facts['common']
-
- ######################################################################
- # We can exit early now if we don't need to set any proxy facts
- proxy_params = ['no_proxy', 'https_proxy', 'http_proxy']
- # If any of the known Proxy Params (pp) are defined
- proxy_settings_defined = any(
- [True for pp in proxy_params if pp in common]
- )
-
- if not proxy_settings_defined:
- common['no_proxy'] = ''
- return facts
-
- # As of 3.6 if ANY of the proxy parameters are defined in the
- # inventory then we MUST add certain domains to the NO_PROXY
- # environment variable.
-
- ######################################################################
-
- # Spot to build up some data we may insert later
- raw_no_proxy_list = []
-
- # Automatic 3.6 NO_PROXY additions if a proxy is in use
- svc_cluster_name = ['.svc', '.' + common['dns_domain'], common['hostname']]
-
- # auto_hosts: Added to NO_PROXY list if any proxy params are
- # set in the inventory. This a list of the FQDNs of all
- # cluster hosts:
- auto_hosts = common['no_proxy_internal_hostnames'].split(',')
-
- # custom_no_proxy_hosts: If you define openshift_no_proxy in
- # inventory we automatically add those hosts to the list:
- if 'no_proxy' in common:
- custom_no_proxy_hosts = common['no_proxy'].split(',')
- else:
- custom_no_proxy_hosts = []
-
- # This should exist no matter what. Defaults to true.
- if 'generate_no_proxy_hosts' in common:
- generate_no_proxy_hosts = safe_get_bool(common['generate_no_proxy_hosts'])
-
- ######################################################################
-
- # You set a proxy var. Now we are obliged to add some things
- raw_no_proxy_list = svc_cluster_name + custom_no_proxy_hosts
-
- # You did not turn openshift_generate_no_proxy_hosts to False
- if generate_no_proxy_hosts:
- raw_no_proxy_list.extend(auto_hosts)
-
- ######################################################################
-
- # Was anything actually added? There should be something by now.
- processed_no_proxy_list = sort_unique(raw_no_proxy_list)
- if processed_no_proxy_list != list():
- common['no_proxy'] = ','.join(processed_no_proxy_list)
- else:
- # Somehow we got an empty list. This should have been
- # skipped by now in the 'return' earlier. If
- # common['no_proxy'] is DEFINED it will cause unexpected
- # behavior and bad templating. Ensure it does not
- # exist. Even an empty list or string will have undesired
- # side-effects.
- del common['no_proxy']
-
- ######################################################################
- # In case you were wondering, because 'common' is a reference
- # to the object facts['common'], there is no need to re-assign
- # it.
+ if 'http_proxy' in common or 'https_proxy' in common or 'no_proxy' in common:
+ if 'no_proxy' in common and isinstance(common['no_proxy'], string_types):
+ common['no_proxy'] = common['no_proxy'].split(",")
+ elif 'no_proxy' not in common:
+ common['no_proxy'] = []
+
+ # See https://bugzilla.redhat.com/show_bug.cgi?id=1466783
+ # masters behind a proxy need to connect to etcd via IP
+ if 'no_proxy_etcd_host_ips' in common:
+ if isinstance(common['no_proxy_etcd_host_ips'], string_types):
+ common['no_proxy'].extend(common['no_proxy_etcd_host_ips'].split(','))
+
+ if 'generate_no_proxy_hosts' in common and safe_get_bool(common['generate_no_proxy_hosts']):
+ if 'no_proxy_internal_hostnames' in common:
+ common['no_proxy'].extend(common['no_proxy_internal_hostnames'].split(','))
+ # We always add local dns domain and ourselves no matter what
+ common['no_proxy'].append('.' + common['dns_domain'])
+ common['no_proxy'].append('.svc')
+ common['no_proxy'].append(common['hostname'])
+ common['no_proxy'] = ','.join(sort_unique(common['no_proxy']))
+ facts['common'] = common
return facts
@@ -2270,14 +2228,10 @@ class OpenShiftFacts(object):
product_version = self.system_facts['ansible_product_version']
virt_type = self.system_facts['ansible_virtualization_type']
virt_role = self.system_facts['ansible_virtualization_role']
+ bios_vendor = self.system_facts['ansible_system_vendor']
provider = None
metadata = None
- # TODO: this is not exposed through module_utils/facts.py in ansible,
- # need to create PR for ansible to expose it
- bios_vendor = get_file_content( # noqa: F405
- '/sys/devices/virtual/dmi/id/bios_vendor'
- )
if bios_vendor == 'Google':
provider = 'gce'
metadata_url = ('http://metadata.google.internal/'
diff --git a/roles/openshift_facts/meta/main.yml b/roles/openshift_facts/meta/main.yml
index 7eead2d6e..0be3afd24 100644
--- a/roles/openshift_facts/meta/main.yml
+++ b/roles/openshift_facts/meta/main.yml
@@ -12,5 +12,4 @@ galaxy_info:
categories:
- cloud
- system
-dependencies:
-- role: openshift_sanitize_inventory
+dependencies: []
diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml
deleted file mode 100644
index 451386bf1..000000000
--- a/roles/openshift_facts/tasks/main.yml
+++ /dev/null
@@ -1,116 +0,0 @@
----
-- name: Detecting Operating System
- stat:
- path: /run/ostree-booted
- register: ostree_booted
-
-# Locally setup containerized facts for now
-- set_fact:
- l_is_atomic: "{{ ostree_booted.stat.exists }}"
-- set_fact:
- l_is_containerized: "{{ (l_is_atomic | bool) or (containerized | default(false) | bool) }}"
- l_is_openvswitch_system_container: "{{ (openshift_use_openvswitch_system_container | default(openshift_use_system_containers) | bool) }}"
- l_is_node_system_container: "{{ (openshift_use_node_system_container | default(openshift_use_system_containers) | bool) }}"
- l_is_master_system_container: "{{ (openshift_use_master_system_container | default(openshift_use_system_containers) | bool) }}"
- l_is_etcd_system_container: "{{ (openshift_use_etcd_system_container | default(openshift_use_system_containers) | bool) }}"
-- set_fact:
- l_any_system_container: "{{ l_is_etcd_system_container or l_is_openvswitch_system_container or l_is_node_system_container or l_is_master_system_container }}"
-- set_fact:
- l_etcd_runtime: "{{ 'runc' if l_is_etcd_system_container else 'docker' if l_is_containerized else 'host' }}"
-
-
-- name: Validate python version
- fail:
- msg: |
- openshift-ansible requires Python 3 for {{ ansible_distribution }};
- For information on enabling Python 3 with Ansible, see https://docs.ansible.com/ansible/python_3_support.html
- when:
- - ansible_distribution == 'Fedora'
- - ansible_python['version']['major'] != 3
- - r_openshift_facts_ran is not defined
-
-- name: Validate python version
- fail:
- msg: "openshift-ansible requires Python 2 for {{ ansible_distribution }}"
- when:
- - ansible_distribution != 'Fedora'
- - ansible_python['version']['major'] != 2
- - r_openshift_facts_ran is not defined
-
-# Fail as early as possible if Atomic and old version of Docker
-- block:
-
- # See https://access.redhat.com/articles/2317361
- # and https://github.com/ansible/ansible/issues/15892
- # NOTE: the "'s can not be removed at this level else the docker command will fail
- # NOTE: When ansible >2.2.1.x is used this can be updated per
- # https://github.com/openshift/openshift-ansible/pull/3475#discussion_r103525121
- - name: Determine Atomic Host Docker Version
- shell: 'CURLY="{"; docker version --format "$CURLY{json .Server.Version}}"'
- register: l_atomic_docker_version
-
- - assert:
- msg: Installation on Atomic Host requires Docker 1.12 or later. Please upgrade and restart the Atomic Host.
- that:
- - l_atomic_docker_version.stdout | replace('"', '') | version_compare('1.12','>=')
-
- when:
- - l_is_atomic | bool
- - r_openshift_facts_ran is not defined
-
-- name: Load variables
- include_vars: "{{ item }}"
- with_first_found:
- - "{{ ansible_distribution }}.yml"
- - "default.yml"
-
-- name: Ensure various deps are installed
- package: name={{ item }} state=present
- with_items: "{{ required_packages }}"
- when:
- - not l_is_atomic | bool
- - r_openshift_facts_ran is not defined
-
-- name: Ensure various deps for running system containers are installed
- package: name={{ item }} state=present
- with_items: "{{ required_system_containers_packages }}"
- when:
- - not l_is_atomic | bool
- - l_any_system_container | bool
- - r_openshift_facts_ran is not defined
-
-- name: Gather Cluster facts and set is_containerized if needed
- openshift_facts:
- role: common
- local_facts:
- debug_level: "{{ openshift_debug_level | default(2) }}"
- deployment_type: "{{ openshift_deployment_type }}"
- deployment_subtype: "{{ openshift_deployment_subtype | default(None) }}"
- cluster_id: "{{ openshift_cluster_id | default('default') }}"
- hostname: "{{ openshift_hostname | default(None) }}"
- ip: "{{ openshift_ip | default(None) }}"
- is_containerized: "{{ l_is_containerized | default(None) }}"
- is_openvswitch_system_container: "{{ l_is_openvswitch_system_container | default(false) }}"
- is_node_system_container: "{{ l_is_node_system_container | default(false) }}"
- is_master_system_container: "{{ l_is_master_system_container | default(false) }}"
- is_etcd_system_container: "{{ l_is_etcd_system_container | default(false) }}"
- etcd_runtime: "{{ l_etcd_runtime }}"
- system_images_registry: "{{ system_images_registry | default('') }}"
- public_hostname: "{{ openshift_public_hostname | default(None) }}"
- public_ip: "{{ openshift_public_ip | default(None) }}"
- portal_net: "{{ openshift_portal_net | default(openshift_master_portal_net) | default(None) }}"
- http_proxy: "{{ openshift_http_proxy | default(None) }}"
- https_proxy: "{{ openshift_https_proxy | default(None) }}"
- no_proxy: "{{ openshift_no_proxy | default(None) }}"
- generate_no_proxy_hosts: "{{ openshift_generate_no_proxy_hosts | default(True) }}"
- no_proxy_internal_hostnames: "{{ openshift_no_proxy_internal_hostnames | default(None) }}"
- sdn_network_plugin_name: "{{ os_sdn_network_plugin_name | default(None) }}"
- use_openshift_sdn: "{{ openshift_use_openshift_sdn | default(None) }}"
-
-- name: Set repoquery command
- set_fact:
- repoquery_cmd: "{{ 'dnf repoquery --latest-limit 1 -d 0' if ansible_pkg_mgr == 'dnf' else 'repoquery --plugins' }}"
-
-- name: Register that this already ran
- set_fact:
- r_openshift_facts_ran: True
diff --git a/roles/openshift_facts/vars/Fedora.yml b/roles/openshift_facts/vars/Fedora.yml
deleted file mode 100644
index 745f5f398..000000000
--- a/roles/openshift_facts/vars/Fedora.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-required_packages:
- - iproute
- - python3-dbus
- - PyYAML
- - yum-utils
diff --git a/roles/openshift_facts/vars/default.yml b/roles/openshift_facts/vars/default.yml
deleted file mode 100644
index 3cd616d16..000000000
--- a/roles/openshift_facts/vars/default.yml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-required_packages:
- - iproute
- - python-dbus
- - PyYAML
- - yum-utils
diff --git a/roles/openshift_facts/vars/main.yml b/roles/openshift_facts/vars/main.yml
deleted file mode 100644
index 89d4034d3..000000000
--- a/roles/openshift_facts/vars/main.yml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-required_system_containers_packages:
- - atomic
- - ostree
- - runc