From 5695de6e99311bc47f30fce00ca2b56f3e9439e5 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Mon, 14 Mar 2022 12:04:57 +0000 Subject: [PATCH] Some quick updates * Updating to use -a instead of --application * use -r for jq, and not use sed --- scripts/arif-scripts/99-post-setup.sh | 17 ++++++++-------- .../update_landscape_certs_self.sh | 20 +++++++++++++------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/scripts/arif-scripts/99-post-setup.sh b/scripts/arif-scripts/99-post-setup.sh index 893d25c..cc8d5ef 100755 --- a/scripts/arif-scripts/99-post-setup.sh +++ b/scripts/arif-scripts/99-post-setup.sh @@ -4,26 +4,27 @@ juju_status_json=$(juju status --format json) # ldap for i in `seq 1 3`; do - ldap_ip=$(echo $juju_status_json | jq .applications[\"ldap-domain${i}\"].units[][\"public-address\"] | sed s/\"//g) + ldap_ip=$(echo $juju_status_json | jq -r .applications[\"ldap-domain${i}\"].units[][\"public-address\"]) juju config keystone-ldap-domain${i} ldap-server=ldap://${ldap_ip} done # landscape -landscape_ip=$(echo $juju_status_json | jq .applications[\"landscape-haproxy\"].units[][\"public-address\"] | sed s/\"//g) +landscape_ip=$(echo $juju_status_json | jq -r .applications[\"landscape-haproxy\"].units[][\"public-address\"]) juju run --all "echo ${landsape_ip} landscape.example.com | sudo tee -a /etc/hosts" # fix ceilometer, so that it can get to keystone -juju run --application ceilometer "echo 10.0.1.216 keystone.example.com | sudo tee -a /etc/hosts" -juju run-action ceilometer/0 ceilometer-upgrade +juju run -a ceilometer "echo 10.0.1.216 keystone.example.com | sudo tee -a /etc/hosts" +juju run-action ceilometer/leader ceilometer-upgrade # ensure openstack-service-checks can get to keystone -juju run --application openstack-service-checks "echo 10.0.1.216 keystone.example.com | sudo tee -a /etc/hosts" -juju run --application openstack-service-checks "echo 10.0.1.216 keystone-internal.example.com | sudo tee -a /etc/hosts" +juju run -a openstack-service-checks "echo 10.0.1.216 keystone.example.com | sudo tee -a /etc/hosts" +juju run -a openstack-service-checks "echo 10.0.1.216 keystone-internal.example.com | sudo tee -a /etc/hosts" # ensure ceph-osd can get to vault -juju run --application ceph-osd "echo 10.0.1.222 vault.example.com | sudo tee -a /etc/hosts" -juju run --application ceph-osd "echo 10.0.1.222 vault-internal.example.com | sudo tee -a /etc/hosts" +juju run -a ceph-osd "echo 10.0.1.222 vault.example.com | sudo tee -a /etc/hosts" +juju run -a ceph-osd "echo 10.0.1.222 vault-internal.example.com | sudo tee -a /etc/hosts" +# Ensure heat domain, role and users have been set up juju run-action --wait heat/leader domain-setup diff --git a/scripts/arif-scripts/update_landscape_certs_self.sh b/scripts/arif-scripts/update_landscape_certs_self.sh index d3f0ed6..d7dc8cc 100755 --- a/scripts/arif-scripts/update_landscape_certs_self.sh +++ b/scripts/arif-scripts/update_landscape_certs_self.sh @@ -2,14 +2,22 @@ # This is when landscape-haproxy the cert is SELFSIGNED. This will ensure that landscape will work landscape_crt=$(juju run --application landscape-haproxy 'sudo openssl x509 -in /var/lib/haproxy/default.pem' | base64) -juju config landscape-client ssl-public-key="base64:${landscape_crt}" -juju config landscape-client-bionic ssl-public-key="base64:${landscape_crt}" # 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') -juju config landscape-client url="https://${landscape_ip}/message-system" ping-url="http://${landscape_ip}/ping" -juju config landscape-client-bionic url="https://${landscape_ip}/message-system" ping-url="http://${landscape_ip}/ping" -# May need to restart all the landscape-clients -#juju run --application landscape-client 'sudo systemctl restart landscape-client.service' +juju_status=$(mktemp) +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}" \ + url="https://${landscape_ip}/message-system" \ + ping-url="http://${landscape_ip}/ping" + + juju run -a ${client} 'sudo systemctl restart landscape-client.service' +done