summaryrefslogtreecommitdiffstats
path: root/playbooks/common/openshift-cluster
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/common/openshift-cluster')
-rw-r--r--playbooks/common/openshift-cluster/config.yml2
-rw-r--r--playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml12
-rw-r--r--playbooks/common/openshift-cluster/validate_hostnames.yml26
3 files changed, 40 insertions, 0 deletions
diff --git a/playbooks/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml
index 11e5b68f6..2cad4b362 100644
--- a/playbooks/common/openshift-cluster/config.yml
+++ b/playbooks/common/openshift-cluster/config.yml
@@ -1,6 +1,8 @@
---
- include: evaluate_groups.yml
+- include: validate_hostnames.yml
+
- include: ../openshift-docker/config.yml
- include: ../openshift-etcd/config.yml
diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
index 8ec379109..55c36810f 100644
--- a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+++ b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
@@ -229,12 +229,19 @@
hosts: oo_masters_to_config
vars:
openshift_version: "{{ openshift_pkg_version | default('') }}"
+ roles:
+ - openshift_facts
tasks:
- name: Upgrade to latest available kernel
action: "{{ ansible_pkg_mgr}} name=kernel state=latest"
- name: Upgrade master packages
command: "{{ ansible_pkg_mgr}} update -y {{ openshift.common.service_type }}-master{{ openshift_version }}"
+ when: openshift_pkg_version is not defined
+
+ - name: Upgrade packages
+ command: "{{ ansible_pkg_mgr}} install -y {{ openshift.common.installed_variant_rpms | oo_31_rpm_rename_conversion(openshift_version) | join (' ')}}"
+ when: openshift_pkg_version is defined and deployment_type == 'openshift-enterprise'
- name: Ensure python-yaml present for config upgrade
action: "{{ ansible_pkg_mgr }} name=PyYAML state=present"
@@ -415,6 +422,11 @@
tasks:
- name: Upgrade node packages
command: "{{ ansible_pkg_mgr }} update -y {{ openshift.common.service_type }}-node{{ openshift_version }}"
+ when: openshift_pkg_version is not defined
+
+ - name: Upgrade packages
+ command: "{{ ansible_pkg_mgr}} install -y {{ openshift.common.installed_variant_rpms | oo_31_rpm_rename_conversion(openshift_version) | join (' ')}}"
+ when: openshift_pkg_version is defined and deployment_type == 'openshift-enterprise'
- name: Restart node service
service: name="{{ openshift.common.service_type }}-node" state=restarted
diff --git a/playbooks/common/openshift-cluster/validate_hostnames.yml b/playbooks/common/openshift-cluster/validate_hostnames.yml
new file mode 100644
index 000000000..047431b63
--- /dev/null
+++ b/playbooks/common/openshift-cluster/validate_hostnames.yml
@@ -0,0 +1,26 @@
+---
+- include: evaluate_groups.yml
+
+- name: Gather and set facts for node hosts
+ hosts: oo_nodes_to_config
+ roles:
+ - openshift_facts
+ tasks:
+ - openshift_facts:
+ role: "{{ item.role }}"
+ local_facts: "{{ item.local_facts }}"
+ with_items:
+ - role: common
+ local_facts:
+ hostname: "{{ openshift_hostname | default(None) }}"
+ public_hostname: "{{ openshift_public_hostname | default(None) }}"
+ - shell:
+ getent ahostsv4 {{ openshift.common.hostname }} | head -n 1 | awk '{ print $1 }'
+ register: lookupip
+ changed_when: false
+ failed_when: false
+ - name: Warn user about bad openshift_hostname values
+ pause:
+ prompt: "The hostname \"{{ openshift.common.hostname }}\" for \"{{ ansible_nodename }}\" doesn't resolve to an ip address owned by this host. Please set openshift_hostname variable to a hostname that when resolved on the host in question resolves to an IP address matching an interface on this host. This host will fail liveness checks for pods utilizing hostPorts, press CTRL-C to continue."
+ seconds: "{{ 10 if openshift_override_hostname_check | default(false) | bool else omit }}"
+ when: lookupip.stdout not in ansible_all_ipv4_addresses