Update scripts from local machine

This commit is contained in:
2025-09-08 15:46:41 +01:00
parent 6aa08bf440
commit cda7ee3cd8
5 changed files with 29 additions and 17 deletions

View File

@@ -1,17 +1,23 @@
#!/bin/bash
default_model="cpe-jammy"
check_controller()
{
controller=$1
model="cpe-jammy"
model="$2"
juju status -m "${controller}":${model} --color | grep "Unit " -A 999999 | grep -E -v "started.*ubuntu@|active.*idle"
juju status -m "${controller}":${model} --color | grep "Unit " -A 999999 | grep -E -v "started.*bionic|started.*focal|started.*ubuntu@|active.*idle"
}
if [[ -z "$1" ]] ; then
if [[ -z "$1" ]] && [[ -z $2 ]] ; then
check_controller "$(juju controllers --format json | jq -r .\"current-controller\")"
elif [[ -z "$1" ]]; then
check_controller "$(juju controllers --format json | jq -r .\"current-controller\")" "${default_model}"
elif [[ -z "$2" ]]; then
check_controller "$(juju controllers --format json | jq -r .\"current-controller\")" "${default_model}"
else
check_controller "${1}"
check_controller "${1}" "${2}"
fi

View File

@@ -228,6 +228,9 @@ do_ovn_resync()
ovn_lead=$(get_lead "${ovn_app}")
ovn_lead_ip=$(jq -r '.applications.${ovn_app}.units."'${ovn_lead}'"."public-address"' "${juju_status_out}")
nb_port=6643
sb_port=6644
for unit in $ovn_names
do
${juju_run_action} $unit pause
@@ -239,16 +242,16 @@ do_ovn_resync()
${juju_run} -u ${ovn_lead} -- rm -rf /tmp/standalone_ovnsb_db.db
${juju_run} -u ${ovn_lead} -- ovsdb-tool create /tmp/standalone_ovnnb_db.db /usr/share/ovn/ovn-nb.ovsschema
${juju_run} -u ${ovn_lead} -- ovsdb-tool create /tmp/standalone_ovnsb_db.db /usr/share/ovn/ovn-sb.ovsschema
${juju_run} -u ${ovn_lead} -- ovsdb-tool create-cluster /var/lib/ovn/ovnnb_db.db /tmp/standalone_ovnnb_db.db ssl:${ovn_lead_ip}:6643
${juju_run} -u ${ovn_lead} -- ovsdb-tool create-cluster /var/lib/ovn/ovnsb_db.db /tmp/standalone_ovnsb_db.db ssl:${ovn_lead_ip}:6644
${juju_run} -u ${ovn_lead} -- ovsdb-tool create-cluster /var/lib/ovn/ovnnb_db.db /tmp/standalone_ovnnb_db.db ssl:${ovn_lead_ip}:${nb_port}
${juju_run} -u ${ovn_lead} -- ovsdb-tool create-cluster /var/lib/ovn/ovnsb_db.db /tmp/standalone_ovnsb_db.db ssl:${ovn_lead_ip}:${sb_port}
${juju_run_action} ${ovn_lead} resume
ovn_nb_uuid=$(${juju_run} -u ${ovn_lead} -- "ovn-appctl -t /var/run/ovn/ovnnb_db.ctl cluster/status OVN_Northbound | grep ^Cluster | awk '{print \$4}' | sed -e s/\(//g -e s/\)//g")
ovn_sb_uuid=$(${juju_run} -u ${ovn_lead} -- "ovn-appctl -t /var/run/ovn/ovnsb_db.ctl cluster/status OVN_Southbound | grep ^Cluster | awk '{print \$4}' | sed -e s/\(//g -e s/\)//g")
ovn_hosts_nb="ssl:${ovn_lead_ip}:6643"
ovn_hosts_sb="ssl:${ovn_lead_ip}:6644"
ovn_hosts_nb="ssl:${ovn_lead_ip}:${nb_port}"
ovn_hosts_sb="ssl:${ovn_lead_ip}:${sb_port}"
for unit in $ovn_names
do
@@ -256,8 +259,8 @@ do_ovn_resync()
ovn_unit_ip=$(jq -r '.applications."ovn-central".units."'${unit}'"."public-address"' "${juju_status_out}")
ovn_hosts_nb="ssl:${ovn_unit_ip}:6643 ${ovn_hosts_nb}"
ovn_hosts_sb="ssl:${ovn_unit_ip}:6644 ${ovn_hosts_sb}"
ovn_hosts_nb="ssl:${ovn_unit_ip}:${nb_port} ${ovn_hosts_nb}"
ovn_hosts_sb="ssl:${ovn_unit_ip}:${sb_port} ${ovn_hosts_sb}"
${juju_run} -u ${unit} -- ovsdb-tool --cid=${ovn_nb_uuid} join-cluster /var/lib/ovn/ovnnb_db.db OVN_Northbound ${ovn_hosts_nb}
${juju_run} -u ${unit} -- ovsdb-tool --cid=${ovn_sb_uuid} join-cluster /var/lib/ovn/ovnsb_db.db OVN_Southbound ${ovn_hosts_sb}

View File

@@ -7,6 +7,7 @@
# Example: ./get_all_relations_info.sh keystone/1
. functions.sh
model=""
check_juju_version
APP=`echo ${1} | awk -F\/+ '{print $1}'`

View File

@@ -1,10 +1,10 @@
Unseal Key 1: RtovEr6q8xNSaCImqaWpp002PphC+o/AwZm9sOmbK1Vg
Unseal Key 2: teEUylJ1EzNRB4ZJuUTwFaK4BA3xOt9KUhcSIVKXi0TF
Unseal Key 3: 8wZmMJJ6TqCjB5/RDXbqJC6t0+MHJBjm+CdIu0db59eV
Unseal Key 4: mYNQzPMnxNRqGwFylLgLsFD2eeL1GmAD6y75SjTsaXUm
Unseal Key 5: kPBl+CC6HGNXho3XrBAvl4gnYU381P5wZ9SnurenUKTU
Unseal Key 1: b5yGkD2xN8nf++CMJww7nMUnim1a09JIv+mdjhV3i0ZB
Unseal Key 2: 5PumGhWmpMBcSDX7ExUNTr06qB2OHIflPn5iaQrr+fdt
Unseal Key 3: DvU2mKGf9r210ZIOiY2b4ljxaStzMbEq6K76tG9cQkKh
Unseal Key 4: 0jD3t5vqOaLiR7Usc7M4i0e8V2evKE5sEjaCNdTlVT/k
Unseal Key 5: PqHUQfbGQ8HaC/CpJSVSxMjfaF5QDefkMl+LDR9+eGSM
Initial Root Token: s.GqPbY2ceIiaxiuMKj3QserDL
Initial Root Token: s.TCfP7SCukB102PxhXBvECA65
Vault initialized with 5 key shares and a key threshold of 3. Please securely
distribute the key shares printed above. When the Vault is re-sealed,

View File

@@ -7,6 +7,9 @@ get_juju_status
vault_file="vault-secrets.txt"
vault_token_file="vault-token.txt"
vault_vip=$(${juju_config} vault vip)
export VAULT_ADDR="http://${vault_vip}:8200"
vault operator init -key-shares=5 -key-threshold=3 > ${vault_file}
@@ -14,7 +17,6 @@ do_vault
initial_token=$(grep Initial ${vault_file} | awk '{print $4}')
export VAULT_ADDR="http://${vault_vip}:8200"
export VAULT_TOKEN=${initial_token}
vault token create -ttl=10m > ${vault_token_file}