diff --git a/check_juju.sh b/check_juju.sh index 302be39..0dc3536 100755 --- a/check_juju.sh +++ b/check_juju.sh @@ -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 diff --git a/functions.sh b/functions.sh index 75eea40..575d0a2 100644 --- a/functions.sh +++ b/functions.sh @@ -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} diff --git a/get_all_relation_info.sh b/get_all_relation_info.sh index c30ae72..a8cc78e 100755 --- a/get_all_relation_info.sh +++ b/get_all_relation_info.sh @@ -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}'` diff --git a/vault-secrets.txt b/vault-secrets.txt index 5388309..b7c3641 100644 --- a/vault-secrets.txt +++ b/vault-secrets.txt @@ -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, diff --git a/vault_init.sh b/vault_init.sh index 7bd8cc2..6871481 100755 --- a/vault_init.sh +++ b/vault_init.sh @@ -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}