A few updates

* Enable juju ha
* target juju tagged nodes for juju controllers
* Only update interfaces if they don't exist on the hypervisors
This commit is contained in:
2021-02-08 09:08:49 +00:00
parent 748c97aa7d
commit 5029e9735a
4 changed files with 18 additions and 7 deletions

View File

@@ -322,7 +322,7 @@ fi
echo "Details for cloud.......: $cloud_name..."
juju clouds --local --format json | jq --arg cloud "$cloud_name" '.[$cloud]'
juju bootstrap "$cloud_name" --debug --config=config-"$rand_uuid".yaml
juju bootstrap "$cloud_name" --debug --config=config-"$rand_uuid".yaml --constraints "tags=juju"
# Since we created ephemeral files, let's wipe them out. Comment if you want to keep them around
if [[ $? = 0 ]]; then
@@ -330,7 +330,7 @@ fi
fi
# Only enable HA if the variable is set and true
[[ -n "$juju_ha" ]] && [[ $juju_ha == "true" ]] && juju enable-ha
[[ -n "$juju_ha" ]] && [[ $juju_ha == "true" ]] && juju enable-ha --constraints "tags=juju"
juju machines -m controller
}

View File

@@ -25,7 +25,7 @@ juju_disk=20
# Control node count and definition
control_count=1
control_cpus=4
control_cpus=3
control_ram=8192
# Compute node definition

View File

@@ -1,5 +1,5 @@
juju_version="latest/stable"
juju_ha="false"
juju_ha="true"
launchpad_user="arif-ali"
package_repository="http://192.168.1.12/ubuntu/"
maas_bridge_ip="10.0.1.253"

View File

@@ -31,8 +31,12 @@ maas_assign_networks()
mode="STATIC"
ip_addr="ip_address=$hypervisor_ip"
else
vlan_int=$(maas ${maas_profile} interfaces create-vlan ${system_id} vlan=${maas_vlan_id} parent=$phys_int_id)
vlan_int_id=$(echo $vlan_int | jq .id | sed s/\"//g)
# Check to see if the vlan interface already exists, otherwise create it
vlan_int_id=$(maas ${maas_profile} interfaces read ${system_id} | jq --argjson vlan ${vlan} '.[] | select(.vlan.vid == $vlan) | select(.type == "vlan") | .id')
if [[ -z "$vlan_int_id" ]] ; then
vlan_int=$(maas ${maas_profile} interfaces create-vlan ${system_id} vlan=${maas_vlan_id} parent=$phys_int_id)
vlan_int_id=$(echo $vlan_int | jq .id | sed s/\"//g)
fi
if [[ $vlan -eq $external_vlan ]] ; then
# Set the external IP to be static as per the configuration
mode="STATIC"
@@ -42,9 +46,16 @@ maas_assign_networks()
mode="AUTO"
fi
fi
bridge_int=$(maas ${maas_profile} interfaces create-bridge ${system_id} name=${bridges[$i]} vlan=$maas_vlan_id mac_address=${hypervisor_mac} parent=$vlan_int_id)
# Check to see if the bridge interface already exists, otherwise create it
bridge_int=$(maas ${maas_profile} interfaces read ${system_id} | jq --argjson vlan ${vlan} '.[] | select(.vlan.vid == $vlan) | select(.type == "bridge")')
[[ -z "${bridge_int}" ]] && bridge_int=$(maas ${maas_profile} interfaces create-bridge ${system_id} name=${bridges[$i]} vlan=$maas_vlan_id mac_address=${hypervisor_mac} parent=$vlan_int_id)
bridge_int_id=$(echo $bridge_int | jq .id | sed s/\"//g)
cur_mode=$(echo $bridge_int | jq ".links[].mode" | sed s/\"//g)
# If the mode is already set correctly, then move on
[[ $cur_mode == "auto" ]] && [[ $mode == "AUTO" ]] && continue
#bridge_unlink=$(maas ${maas_profile} interface unlink-subnet $system_id $bridge_int_id id=$( echo $bridge_int_id | jq {maas_subnet_id})
bridge_link=$(maas ${maas_profile} interface link-subnet $system_id $bridge_int_id mode=${mode} subnet=${maas_subnet_id} ${ip_addr})
echo $bridge_link
(( i++ ))
done
}