summaryrefslogtreecommitdiffstats
path: root/playbooks/common
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-02-03 13:11:26 -0500
committerBrenton Leanhardt <bleanhar@redhat.com>2016-02-03 13:11:26 -0500
commit34b68829e36f7151c6c09411585b25b2340d2823 (patch)
tree6ed1e18dbbeae57bf2f05ab171b053c11a845b79 /playbooks/common
parentb40b5a26bb1a731dce16f3d0ba381a52ecd5dc8a (diff)
parentcf9403fa748e54d35afe7e8416aa736d6ea375d2 (diff)
downloadopenshift-34b68829e36f7151c6c09411585b25b2340d2823.tar.gz
openshift-34b68829e36f7151c6c09411585b25b2340d2823.tar.bz2
openshift-34b68829e36f7151c6c09411585b25b2340d2823.tar.xz
openshift-34b68829e36f7151c6c09411585b25b2340d2823.zip
Merge pull request #1291 from sdodson/bz1293578
Check that openshift_hostname resolves to an ip on our host
Diffstat (limited to 'playbooks/common')
-rw-r--r--playbooks/common/openshift-cluster/config.yml2
-rw-r--r--playbooks/common/openshift-cluster/validate_hostnames.yml26
2 files changed, 28 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/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