summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/etcd/tasks/main.yml5
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py12
-rw-r--r--roles/openshift_manage_node/tasks/main.yml10
-rw-r--r--roles/openshift_master/tasks/main.yml3
-rw-r--r--roles/openshift_node/templates/node.yaml.v1.j22
5 files changed, 22 insertions, 10 deletions
diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml
index ba4136327..2bc6a8678 100644
--- a/roles/etcd/tasks/main.yml
+++ b/roles/etcd/tasks/main.yml
@@ -34,16 +34,17 @@
command: systemctl show etcd.service
register: etcd_show
changed_when: false
+ failed_when: false
- name: Disable system etcd when containerized
- when: etcd_is_containerized | bool and 'LoadState=not-found' not in etcd_show.stdout
+ when: etcd_is_containerized | bool and etcd_show.rc == 0 and 'LoadState=not-found' not in etcd_show.stdout
service:
name: etcd
state: stopped
enabled: no
- name: Mask system etcd when containerized
- when: etcd_is_containerized | bool and 'LoadState=not-found' not in etcd_show.stdout
+ when: etcd_is_containerized | bool and etcd_show.rc == 0 and 'LoadState=not-found' not in etcd_show.stdout
command: systemctl mask etcd
- name: Reload systemd units
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index b2d007ec9..e94cb0952 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -149,6 +149,7 @@ def hostname_valid(hostname):
if (not hostname or
hostname.startswith('localhost') or
hostname.endswith('localdomain') or
+ hostname.endswith('novalocal') or
len(hostname.split('.')) < 2):
return False
@@ -918,6 +919,14 @@ def set_sdn_facts_if_unset(facts, system_facts):
return facts
+def set_nodename(facts):
+ if 'node' in facts and 'common' in facts:
+ if 'cloudprovider' in facts and facts['cloudprovider']['kind'] == 'openstack':
+ facts['node']['nodename'] = facts['provider']['metadata']['hostname'].replace('.novalocal', '')
+ else:
+ facts['node']['nodename'] = facts['common']['hostname'].lower()
+ return facts
+
def migrate_oauth_template_facts(facts):
"""
Migrate an old oauth template fact to a newer format if it's present.
@@ -1220,7 +1229,7 @@ def apply_provider_facts(facts, provider_facts):
facts['common'][h_var] = choose_hostname(
[provider_facts['network'].get(h_var)],
- facts['common'][ip_var]
+ facts['common'][h_var]
)
facts['provider'] = provider_facts
@@ -1701,6 +1710,7 @@ class OpenShiftFacts(object):
facts = set_proxy_facts(facts)
if not safe_get_bool(facts['common']['is_containerized']):
facts = set_installed_variant_rpm_facts(facts)
+ facts = set_nodename(facts)
return dict(openshift=facts)
def get_defaults(self, roles, deployment_type, deployment_subtype):
diff --git a/roles/openshift_manage_node/tasks/main.yml b/roles/openshift_manage_node/tasks/main.yml
index f45ade751..d1cc5b274 100644
--- a/roles/openshift_manage_node/tasks/main.yml
+++ b/roles/openshift_manage_node/tasks/main.yml
@@ -14,7 +14,7 @@
- name: Wait for Node Registration
command: >
- {{ openshift.common.client_binary }} get node {{ hostvars[item].openshift.common.hostname | lower }}
+ {{ openshift.common.client_binary }} get node {{ hostvars[item].openshift.node.nodename }}
--config={{ openshift_manage_node_kubeconfig }}
-n default
register: omd_get_node
@@ -26,19 +26,19 @@
- name: Set node schedulability
command: >
- {{ openshift.common.admin_binary }} manage-node {{ hostvars[item].openshift.common.hostname | lower }} --schedulable={{ 'true' if hostvars[item].openshift.node.schedulable | bool else 'false' }}
+ {{ openshift.common.admin_binary }} manage-node {{ hostvars[item].openshift.node.nodename }} --schedulable={{ 'true' if hostvars[item].openshift.node.schedulable | bool else 'false' }}
--config={{ openshift_manage_node_kubeconfig }}
-n default
with_items: "{{ openshift_nodes }}"
- when: hostvars[item].openshift.common.hostname is defined
+ when: hostvars[item].openshift.node.nodename is defined
- name: Label nodes
command: >
- {{ openshift.common.client_binary }} label --overwrite node {{ hostvars[item].openshift.common.hostname | lower }} {{ hostvars[item].openshift.node.labels | oo_combine_dict }}
+ {{ openshift.common.client_binary }} label --overwrite node {{ hostvars[item].openshift.node.nodename }} {{ hostvars[item].openshift.node.labels | oo_combine_dict }}
--config={{ openshift_manage_node_kubeconfig }}
-n default
with_items: "{{ openshift_nodes }}"
- when: hostvars[item].openshift.common.hostname is defined and 'labels' in hostvars[item].openshift.node and hostvars[item].openshift.node.labels != {}
+ when: hostvars[item].openshift.node.nodename is defined and 'labels' in hostvars[item].openshift.node and hostvars[item].openshift.node.labels != {}
- name: Delete temp directory
file:
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index d8a4aa9bb..ce2f96723 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -178,13 +178,14 @@
command: systemctl show {{ openshift.common.service_type }}-master.service
register: master_svc_show
changed_when: false
+ failed_when: false
- name: Stop and disable non-HA master when running HA
service:
name: "{{ openshift.common.service_type }}-master"
enabled: no
state: stopped
- when: openshift_master_ha | bool and 'LoadState=not-found' not in master_svc_show.stdout
+ when: openshift_master_ha | bool and master_svc_show.rc == 0 and 'LoadState=not-found' not in master_svc_show.stdout
- set_fact:
master_service_status_changed: "{{ start_result | changed }}"
diff --git a/roles/openshift_node/templates/node.yaml.v1.j2 b/roles/openshift_node/templates/node.yaml.v1.j2
index 68d153052..9bcaf4d84 100644
--- a/roles/openshift_node/templates/node.yaml.v1.j2
+++ b/roles/openshift_node/templates/node.yaml.v1.j2
@@ -33,7 +33,7 @@ networkConfig:
{% if openshift.node.set_node_ip | bool %}
nodeIP: {{ openshift.common.ip }}
{% endif %}
-nodeName: {{ openshift.common.hostname | lower }}
+nodeName: {{ openshift.node.nodename }}
podManifestConfig:
servingInfo:
bindAddress: 0.0.0.0:10250