Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 1 | # Doesn't seem to be a MAAS module for Ansible yet |
| 2 | - name: Get MAAS credentials |
| 3 | become: yes |
| 4 | command: maas-region-admin apikey --username=cord |
| 5 | register: maas_key |
| 6 | tags: |
| 7 | - skip_ansible_lint |
| 8 | |
| 9 | - name: Login to MAAS |
| 10 | command: maas login cord http://localhost/MAAS/api/1.0 {{ maas_key.stdout }} |
| 11 | tags: |
| 12 | - skip_ansible_lint |
| 13 | |
| 14 | - name: Wait for node to become ready |
| 15 | shell: maas cord nodes list|jq -r '.[] | select(.status == 0).system_id' |
| 16 | register: nodeid |
| 17 | until: nodeid.stdout |
| 18 | retries: 40 |
| 19 | delay: 15 |
| 20 | tags: |
| 21 | - skip_ansible_lint |
| 22 | |
| 23 | # We need to be able to reboot the VM on the physical server running CiaB |
| 24 | - name: Add remote power state |
| 25 | command: maas cord node update {{ nodeid.stdout }} power_type="virsh" power_parameters_power_address="qemu+ssh://{{ maas_user }}@10.100.198.1/system" power_parameters_power_id="{{ vagrant_name }}" |
| 26 | tags: |
| 27 | - skip_ansible_lint |
| 28 | |
| 29 | - name: Wait for node to be fully provisioned |
| 30 | become: yes |
| 31 | shell: /usr/local/bin/get-node-prov-state |jq '.[] | select(.id == "{{ nodeid.stdout }}").status' |
| 32 | register: prov_state |
| 33 | until: prov_state.stdout == "2" |
Andy Bavier | e7bbcb5 | 2016-12-01 11:38:52 -0500 | [diff] [blame] | 34 | retries: 120 |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 35 | delay: 30 |
| 36 | tags: |
| 37 | - skip_ansible_lint |