| #! /bin/bash |
| #set -x |
| NODE=$( bash -c "source ~/service-profile/cord-pod/admin-openrc.sh; nova list --all-tenants 2>&1 | grep -m 1 ceilometer | cut -d ' ' -f 2 | xargs -I{} nova show {} 2>&1 | grep -m 1 hypervisor | tr -s ' ' | cut -d ' ' -f 4") |
| |
| INSTANCE_IP=$( bash -c "source ~/service-profile/cord-pod/admin-openrc.sh; nova list --all-tenants 2>&1 | grep -m 1 ceilometer | cut -d ' ' -f 2 | xargs -I{} nova show {} 2>&1 | grep -m 1 management | tr -s ' ' | cut -d ' ' -f 5") |
| |
| cat <<EOF > install_monitoring_agent.config |
| [ssh_connection] |
| ssh_args = -o "ProxyCommand ssh -q -i ~/service-profile/cord-pod/node_key -o StrictHostKeyChecking=no ubuntu@$NODE nc $INSTANCE_IP 22" |
| scp_if_ssh = True |
| pipelining = True |
| |
| [defaults] |
| host_key_checking = False |
| timeout = 30 |
| EOF |
| |
| ANSIBLE_CONFIG=install_monitoring_agent.config ansible-playbook -vvv -i /etc/maas/ansible/pod-inventory ~/xos_services/PassiveTest/install_monitoring_plugin.yaml -e instance_ip="$INSTANCE_IP" -e instance_host="$NODE" |
| |