@@ -224,9 +224,22 @@ function node_map_to_install_config_hosts() {
224224 start_idx=" $2 "
225225 role=" $3 "
226226
227- for (( idx= $start_idx ;idx< $(($1 + $start_idx )) ; idx++)); do
227+ # If arbiter is enabled, an arbiter node will be created so we increase the number of hosts by 1
228+ # when the role is for master to capture the arbiter position.
229+ # If the role is for a worker, we increment the index since the worker position has moved by 1.
230+ if [[ ! -z " ${ENABLE_ARBITER:- } " && " $role " == " master" ]]; then
231+ num_hosts=$(( num_hosts + 1 ))
232+ elif [[ ! -z " ${ENABLE_ARBITER:- } " && " $role " == " worker" ]]; then
233+ start_idx=$(( start_idx + 1 ))
234+ fi
235+
236+ for (( idx= $start_idx ;idx< $(($num_hosts + $start_idx )) ; idx++)); do
228237 name=$( node_val ${idx} " name" )
229238 mac=$( node_val ${idx} " ports[0].address" )
239+ local node_role=$role
240+ if [[ ! -z " ${ENABLE_ARBITER:- } " && $name =~ " arbiter" && " $role " == " master" ]]; then
241+ node_role=arbiter
242+ fi
230243
231244 driver=$( node_val ${idx} " driver" )
232245 if [ $driver == " ipmi" ] ; then
@@ -247,7 +260,7 @@ function node_map_to_install_config_hosts() {
247260
248261 cat << EOF
249262 - name: ${name}
250- role: ${role }
263+ role: ${node_role }
251264 bmc:
252265 address: ${address}
253266 username: ${username}
266279 # FIXME(stbenjam) Worker code in installer should accept
267280 # "default" as well -- currently the mapping doesn't work,
268281 # so we use the raw value for BMO's default which is "unknown"
269- if [[ " $role " == " master" ]]; then
282+ if [[ " $node_role " == " master" ]] || [[ " $node_role " == " arbiter " ]] ; then
270283 if [ -z " ${MASTER_HARDWARE_PROFILE:- } " ]; then
271284 cat << EOF
272285 rootDeviceHints:
0 commit comments