2021-10-29 09:57:19 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# This is when landscape-haproxy the cert is SELFSIGNED. This will ensure that landscape will work
|
2022-03-17 19:09:11 +00:00
|
|
|
juju run --application landscape-haproxy 'sudo openssl x509 -in /var/lib/haproxy/default.pem' > landscape_cert.crt
|
|
|
|
landscape_crt=$(base64 < landscape_cert.crt)
|
2021-10-29 09:57:19 +01:00
|
|
|
|
|
|
|
# And yes, this needs to use the IP address, otherwise the the registration will fail
|
|
|
|
landscape_ip=$(juju run --application landscape-haproxy 'unit-get private-address')
|
|
|
|
|
2022-03-14 12:04:57 +00:00
|
|
|
juju_status=$(mktemp)
|
2021-10-29 09:57:19 +01:00
|
|
|
|
2022-03-14 12:04:57 +00:00
|
|
|
juju status --format json > "${juju_status}"
|
|
|
|
|
|
|
|
clients=$(jq -r ".applications | to_entries[] | select(.value[\"charm-name\"] == \"landscape-client\") | .key" "${juju_status}")
|
|
|
|
|
|
|
|
for client in ${clients} ; do
|
|
|
|
juju config ${client} --reset ssl-public-key,url,ping-url
|
|
|
|
|
|
|
|
juju config ${client} ssl-public-key="base64:${landscape_crt}" \
|
2022-07-12 21:12:31 +01:00
|
|
|
url="https://landscape.example.com/message-system" \
|
|
|
|
ping-url="http://landscape.example.com/ping"
|
2022-03-14 12:04:57 +00:00
|
|
|
|
|
|
|
juju run -a ${client} 'sudo systemctl restart landscape-client.service'
|
|
|
|
done
|
2022-03-17 19:09:11 +00:00
|
|
|
|
|
|
|
# for the infra model
|
|
|
|
models="infra controller"
|
|
|
|
client="landscape-client"
|
|
|
|
|
|
|
|
for model in ${models}
|
|
|
|
do
|
|
|
|
juju config -m ${model} ${client} --reset ssl-public-key,url,ping-url
|
|
|
|
|
|
|
|
juju config -m ${model} ${client} ssl-public-key="base64:${landscape_crt}" \
|
2022-07-12 21:12:31 +01:00
|
|
|
url="https://landscape.example.com/message-system" \
|
|
|
|
ping-url="http://landscape.example.com/ping"
|
2022-03-17 19:09:11 +00:00
|
|
|
|
|
|
|
juju run -m ${model} -a ${client} 'sudo systemctl restart landscape-client.service'
|
|
|
|
done
|