useful_scripts/get_all_ips.sh
Arif Ali a90392cc89
Update + add scripts
* Added a simple check juju script
* fix cloud script for focal, similar to the bionic one
* initialise vault scipt
* Update get_password script to add innodb
* Added a new script for check_vip_issue_db.sh
2022-01-27 10:08:00 +00:00

14 lines
606 B
Bash
Executable File

#!/bin/bash
juju_status=$(mktemp)
juju status --format json > $juju_status
# old method
#cat ${juju_status} | jq -rc '.machines | to_entries[] |[.key,.value.hostname,.value."ip-addresses"]'
#cat ${juju_status} | jq -rc '.machines | to_entries[] | select(.value.containers != null ) | .value.containers | to_entries[] | [.key,.value.hostname,.value."ip-addresses"]'
# new method
cat ${juju_status} | jq -rc '.machines | to_entries[] |[.key,.value.hostname,.value."ip-addresses", [(select(.value.containers != null ) | .value.containers | to_entries[] | [.key,.value.hostname,.value."ip-addresses"])]]'