Created
March 28, 2017 01:26
-
-
Save mpontillo/4be4217274c12a5e33543aff745390f8 to your computer and use it in GitHub Desktop.
Get all BMC IP addresses and which nodes use them from the MAAS database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat << EOF | sudo -u postgres psql -P pager=off maasdb 2> /dev/null | |
SELECT | |
sip.ip "bmc_ip", | |
node.hostname AS "machine_hostname", | |
bmc.power_type | |
FROM maasserver_bmc bmc | |
LEFT OUTER JOIN maasserver_staticipaddress sip | |
ON sip.id = bmc.ip_address_id | |
LEFT OUTER JOIN maasserver_node node | |
ON bmc.id = node.bmc_id | |
WHERE bmc.ip_address_id IS NOT NULL | |
ORDER BY sip.ip; | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment