diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2017-12-14 14:09:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-14 14:09:29 -0800 |
commit | 49d1242ce0a3413678642c5d8be5197c46bd817c (patch) | |
tree | 783f4b7100e4e411e1fa6b14cde4430222cc7ad7 /playbooks/init/validate_hostnames.yml | |
parent | 58204ec1238d05037d38c69bbc5e06491058902a (diff) | |
parent | 3c47ca9780f827ad8b47601d3870d687c76ae974 (diff) | |
download | openshift-49d1242ce0a3413678642c5d8be5197c46bd817c.tar.gz openshift-49d1242ce0a3413678642c5d8be5197c46bd817c.tar.bz2 openshift-49d1242ce0a3413678642c5d8be5197c46bd817c.tar.xz openshift-49d1242ce0a3413678642c5d8be5197c46bd817c.zip |
Merge pull request #5970 from mtnbikenc/fix-1506750
Automatic merge from submit-queue.
1506750 Validate node hostname and IP address
- Replaces use of `pause` with a `fail` task. `pause` only runs on one host, therefore the check was not run for all nodes
- Adds check for valid openshift_ip
Fixes 1506750
https://bugzilla.redhat.com/show_bug.cgi?id=1506750
Diffstat (limited to 'playbooks/init/validate_hostnames.yml')
-rw-r--r-- | playbooks/init/validate_hostnames.yml | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/playbooks/init/validate_hostnames.yml b/playbooks/init/validate_hostnames.yml index be2e6a15a..86e0b2416 100644 --- a/playbooks/init/validate_hostnames.yml +++ b/playbooks/init/validate_hostnames.yml @@ -1,6 +1,7 @@ --- - name: Validate node hostnames hosts: oo_nodes_to_config + any_errors_fatal: true tasks: - name: Query DNS for IP address of {{ openshift.common.hostname }} shell: @@ -8,16 +9,35 @@ register: lookupip changed_when: false failed_when: false - - name: Warn user about bad openshift_hostname values - pause: - prompt: + + - name: Validate openshift_hostname when defined + fail: + msg: > 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 ENTER to continue or CTRL-C to abort. - seconds: "{{ 10 if openshift_override_hostname_check | default(false) | bool else omit }}" + in question resolves to an IP address matching an interface on this host. + This will ensure proper functionality of OpenShift networking features. + Inventory setting: openshift_hostname={{ openshift_hostname }} + This check can be overridden by setting openshift_hostname_check=false in + the inventory. + See https://docs.openshift.org/latest/install_config/install/advanced_install.html#configuring-host-variables when: - lookupip.stdout != '127.0.0.1' - lookupip.stdout not in ansible_all_ipv4_addresses + - openshift_hostname_check | default(true) + + - name: Validate openshift_ip exists on node when defined + fail: + msg: > + The IP address {{ openshift_ip }} does not exist on {{ ansible_nodename }}. + Please set the openshift_ip variable to an IP address of this node. + This will ensure proper functionality of OpenShift networking features. + Inventory setting: openshift_ip={{ openshift_ip }} + This check can be overridden by setting openshift_ip_check=false in + the inventory. + See https://docs.openshift.org/latest/install_config/install/advanced_install.html#configuring-host-variables + when: + - openshift_ip is defined + - openshift_ip not in ansible_all_ipv4_addresses + - openshift_ip_check | default(true) |