fine tune scripts

* Add snap based juju-db for mongo status
* Update latest vault secrets
* fine tune fix_cloud.sh script to reduce the amount of commands to be run
This commit is contained in:
Arif Ali 2022-10-20 14:41:17 +01:00
parent aff1ce1ef1
commit e943d70891
Signed by: arif
GPG Key ID: 369608FBA1353A70
4 changed files with 20 additions and 18 deletions

View File

@ -4,13 +4,15 @@ machine=${1:-0}
model=${2:-controller}
read -d '' -r cmds <<'EOF'
user=$(sudo ls /var/lib/juju/agents/)
user=$(sudo ls /var/lib/juju/agents/ | grep machine)
conf=/var/lib/juju/agents/${user}/agent.conf
password=$(sudo grep statepassword ${conf} | cut -d' ' -f2)
if [ -f /usr/lib/juju/mongo*/bin/mongo ]; then
client=/usr/lib/juju/mongo*/bin/mongo
else
elif [ -f /usr/bin/mongo ] ; then
client=/usr/bin/mongo
else
client=/snap/bin/juju-db.mongo
fi
${client} 127.0.0.1:37017/juju --authenticationDatabase admin --ssl --sslAllowInvalidCertificates --username "${user}" --password "${password}"
EOF

View File

@ -4,13 +4,15 @@ machine=${1:-0}
model=${2:-controller}
read -d '' -r cmds <<'EOF'
user=$(sudo ls /var/lib/juju/agents/)
user=$(sudo ls /var/lib/juju/agents/ | grep machine)
conf=/var/lib/juju/agents/${user}/agent.conf
password=$(sudo grep statepassword ${conf} | cut -d' ' -f2)
if [ -f /usr/lib/juju/mongo*/bin/mongo ]; then
client=/usr/lib/juju/mongo*/bin/mongo
else
elif [ -f /usr/bin/mongo ]; then
client=/usr/bin/mongo
else
client=/snap/bin/juju-db.mongo
fi
${client} 127.0.0.1:37017/juju --authenticationDatabase admin --ssl --sslAllowInvalidCertificates --username "${user}" --password "${password}" --eval "rs.status()" | grep -P '(name|stateStr)'
EOF

View File

@ -55,7 +55,7 @@ do_vault()
done;
done;
juju run -a vault "hooks/update-status"
#juju run -a vault "hooks/update-status"
}
juju-wait -v
@ -174,16 +174,17 @@ if [[ -n "${mysql_innodb_cluster}" ]] ; then
fi
juju run --application mysql-innodb-cluster "hooks/update-status"
#juju run --application mysql-innodb-cluster "hooks/update-status"
# Run update-status on all mysql-router units, to ensure that theyave connected to the mysql-innodb-cluster
jq -r ".applications | to_entries[] | select(.value[\"charm-name\"] == \"mysql-router\") | .key" "${juju_status}" \
| xargs -I{} juju run -a "{}" -- 'hooks/update-status'
#jq -r ".applications | to_entries[] | select(.value[\"charm-name\"] == \"mysql-router\") | .key" "${juju_status}" \
# | xargs -I{} juju run -a "{}" -- 'hooks/update-status'
fi
fi
juju run -u elasticsearch/leader -- sudo systemctl restart elasticsearch &
juju run -a heat -- sudo systemctl restart heat-engine &
juju run -a vault -- sudo systemctl restart vault &
@ -197,10 +198,7 @@ do_vault
# remove DNS entry for external network
juju run --all -- sudo sed -i -e s/192.168.1.13,//g -e s/192.168.1.9,//g /etc/netplan/99-juju.yaml
juju run --all -- sudo netplan apply
# Ensure DNS works on all the nodes
juju run --all -- sudo systemctl restart systemd-resolved
juju run --all -- "sudo netplan apply ; sudo systemctl restart systemd-resolved"
ceph_osd_apps=$(jq -rc ".applications | to_entries[] | select(.value[\"charm-name\"] == \"ceph-osd\") | .key" "${juju_status}")

View File

@ -1,10 +1,10 @@
Unseal Key 1: xb11HFT+6KBH0y8Jglvmr2ljnVIWZk9YruHLJpR4oVot
Unseal Key 2: aG8MUmlY0NbzHyIp5MSj98q7eCalUhrYmYXXMGozocSn
Unseal Key 3: 1BMKM86m6JMZL9DCypY1rbsfvuiO22Tm0i9E2T6a/UUU
Unseal Key 4: VZ36NLxKn/xC32TGDhThIPlndqSaXhmm3FFEewzoeAXk
Unseal Key 5: bAZ77ThRY6RfHM00q7kkSmknY0tqXla092PDPkuP5NfW
Unseal Key 1: 9dx2PJRhjffPIVDseRc0CJs+VFcAEKb7+aGoUkh0WNqK
Unseal Key 2: Ls2vbOvY/fKYk9B45iPpBV068z4CaWRgQAzwvJRef5bV
Unseal Key 3: dYa88MlsHCWakJF8s+Fe/IvXmVRO1Druk/7h3DPP7WE1
Unseal Key 4: wHTcIPrmJDF8GCFNzSRefrswjrxq+atTqvdl3QVhbabN
Unseal Key 5: C6DFXcr3I8W/aKupiktrYo0/VenuVs2jzzvrCMqI410l
Initial Root Token: s.EQOap6R44K8Hpx3o7lB5ORqs
Initial Root Token: hvs.DxM0VoLHc8f3vZ4csTVK21vU
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,