Fix openshift new node detection
For openshift deployment it is important to know which nodes are new to the cluster so that can be added to the appropriate groups. The new node detection was broken due to the recent switch to containerized undercloud and move to openshift 3.10. This commit fixes the issues by relying on the systemd status rather than docker directly. Change-Id: Ica13d1aaee259d831d32698466ef8971e526483a
This commit is contained in:
parent
7373adc72e
commit
8629bf4ab5
|
@ -170,29 +170,18 @@ outputs:
|
|||
set_fact:
|
||||
tripleo_role_name: {get_param: RoleName}
|
||||
|
||||
# FIXME(mandre) This task always fails:
|
||||
# - become:true doesn't work in that context (containerized undercloud issue?)
|
||||
# - there is no origin-master-api docker container
|
||||
# We should be checking for systemd service status instead.
|
||||
# NOTE(flaper87): Check if origin-node is running in the openshift
|
||||
# nodes so we can flag the node as new later on.
|
||||
#
|
||||
# This task ignores errors because docker inspect exits with 1 if
|
||||
# origin-node doesn't exist. Perhaps we could use failed_when
|
||||
# instead of ignoring the errors. Future improvement.
|
||||
- name: Check if origin-node is running
|
||||
become: true
|
||||
shell: >
|
||||
docker inspect atomic-enterprise-master-api > /dev/null 2>&1
|
||||
|| docker inspect origin-master-api > /dev/null 2>&1
|
||||
|| echo "false"
|
||||
command: systemctl is-active --quiet origin-node
|
||||
register: origin_nodes
|
||||
delegate_to: "{{item}}"
|
||||
with_items: "{{ groups[tripleo_role_name] | default([]) }}"
|
||||
failed_when: false
|
||||
|
||||
- set_fact:
|
||||
nodes:
|
||||
- new_node: "{{origin_nodes.results | selectattr('item', 'equalto', item) | selectattr('stdout', 'equalto', 'false') | list | count > 0}}"
|
||||
- new_node: "{{origin_nodes.results | selectattr('item', 'equalto', item) | selectattr('rc', 'greaterthan', 0) | list | count > 0}}"
|
||||
hostname: "{{item}}"
|
||||
register: all_master_nodes
|
||||
with_items: "{{groups[tripleo_role_name] | default([]) }}"
|
||||
|
|
|
@ -85,34 +85,23 @@ outputs:
|
|||
tripleo_node_group_name: {get_attr: [RoleParametersValue, value, OpenShiftNodeGroupName]}
|
||||
openshift_master_network: {get_param: [ServiceNetMap, OpenshiftMasterNetwork]}
|
||||
|
||||
# FIXME(mandre) This task always fails:
|
||||
# - become:true doesn't work in that context (containerized undercloud issue?)
|
||||
# - there is no origin-master-api docker container
|
||||
# We should be checking for systemd service status instead.
|
||||
# NOTE(flaper87): Check if origin-node is running in the openshift
|
||||
# nodes so we can flag the node as new later on.
|
||||
#
|
||||
# This task ignores errors because docker inspect exits with 1 if
|
||||
# origin-node doesn't exist. Perhaps we could use failed_when
|
||||
# instead of ignoring the errors. Future improvement.
|
||||
- name: Check if origin-node is running
|
||||
become: true
|
||||
shell: >
|
||||
docker inspect atomic-enterprise-master-api > /dev/null 2>&1
|
||||
|| docker inspect origin-master-api > /dev/null 2>&1
|
||||
|| echo "false"
|
||||
command: systemctl is-active --quiet origin-node
|
||||
register: origin_nodes
|
||||
delegate_to: "{{item}}"
|
||||
with_items: "{{ groups[tripleo_role_name] | default([]) }}"
|
||||
failed_when: false
|
||||
|
||||
# NOTE(flaper87): Create all the nodes objects
|
||||
# now, as yaml dicts, instead of formatting
|
||||
# everything as part of a template.
|
||||
# We consider new_node all the nodes that
|
||||
# exited with 1 in the previous task.
|
||||
# NOTE(flaper87): Create all the nodes objects
|
||||
# now, as yaml dicts, instead of formatting
|
||||
# everything as part of a template.
|
||||
# We consider new_node all the nodes that
|
||||
# exited with 1 in the previous task.
|
||||
- set_fact:
|
||||
nodes:
|
||||
- new_node: "{{origin_nodes.results | selectattr('item', 'equalto', item) | selectattr('stdout', 'equalto', 'false') | list | count > 0}}"
|
||||
- new_node: "{{origin_nodes.results | selectattr('item', 'equalto', item) | selectattr('stdout', 'greaterthan', 0) | list | count > 0}}"
|
||||
hostname: "{{item}}"
|
||||
ansible_user: "{{ hostvars[item]['ansible_user'] | default(hostvars[item]['ansible_ssh_user']) | default('root') }}"
|
||||
ansible_host: "{{ hostvars[item]['ansible_host'] | default(item) }}"
|
||||
|
|
Loading…
Reference in New Issue