script to add az as tags automatically from juju status

This commit is contained in:
Arif Ali 2022-03-15 17:52:30 +00:00
parent 88dc6d2977
commit d63c8ac105
Signed by: arif
GPG Key ID: 369608FBA1353A70

View File

@ -44,3 +44,23 @@ do
done
```
If you're using juju, then you might find the following more useful to add tags per AZ
```bash
#!/bin/bash
. landscape_rc
juju_machines=$(mktemp)
juju machines > ${juju_machines}
for az in $(cat ${juju_machines} | awk '{print $6}' | tail +2 | sort | uniq)
do
for host in $(cat ${juju_machines} | grep ${az} | awk '{print $4}')
do
landscape-api add-tags-to-computers title:${host} "${az}"
done
done
```