| #!/bin/bash |
| |
| ID=$1 |
| HOSTNAME=$2 |
| LOG=/etc/maas/ansible/logs/$ID.log |
| |
| INV=$(tempfile) |
| cat >$INV <<EO_INV |
| [head] |
| juju-head-node ansible_user={{ ansible_user_id }} |
| |
| [compute] |
| $HOSTNAME ansible_user=ubuntu |
| EO_INV |
| |
| echo "BEGIN INVENTORY FILE" >> $LOG |
| cat $INV >> $LOG |
| echo "END INVENTORY_FILE" >> $LOG |
| |
| echo "ANSIBLE_ROLES_PATH=/etc/maas/ansible/roles ansible-playbook --private-key=/etc/maas/ansible/id_rsa -i $INV /etc/maas/ansible/cord-compute-playbook.yml" >> $LOG |
| |
| ANSIBLE_ROLES_PATH=/etc/maas/ansible/roles ansible-playbook --private-key=/etc/maas/ansible/id_rsa -i $INV /etc/maas/ansible/cord-compute-playbook.yml >> $LOG |
| RESULT=$? |
| rm $INV |
| |
| exit $RESULT |