Matteo Scandolo | 60b640f | 2017-08-08 13:05:22 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 17 | # Doesn't seem to be a MAAS module for Ansible yet |
| 18 | - name: Get MAAS credentials |
| 19 | become: yes |
| 20 | command: maas-region-admin apikey --username=cord |
| 21 | register: maas_key |
| 22 | tags: |
| 23 | - skip_ansible_lint |
| 24 | |
| 25 | - name: Login to MAAS |
| 26 | command: maas login cord http://localhost/MAAS/api/1.0 {{ maas_key.stdout }} |
| 27 | tags: |
| 28 | - skip_ansible_lint |
| 29 | |
| 30 | - name: Wait for node to become ready |
| 31 | shell: maas cord nodes list|jq -r '.[] | select(.status == 0).system_id' |
| 32 | register: nodeid |
| 33 | until: nodeid.stdout |
| 34 | retries: 40 |
| 35 | delay: 15 |
| 36 | tags: |
| 37 | - skip_ansible_lint |
| 38 | |
| 39 | # We need to be able to reboot the VM on the physical server running CiaB |
| 40 | - name: Add remote power state |
| 41 | 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 }}" |
| 42 | tags: |
| 43 | - skip_ansible_lint |
| 44 | |
| 45 | - name: Wait for node to be fully provisioned |
| 46 | become: yes |
| 47 | shell: /usr/local/bin/get-node-prov-state |jq '.[] | select(.id == "{{ nodeid.stdout }}").status' |
| 48 | register: prov_state |
| 49 | until: prov_state.stdout == "2" |
Andy Bavier | e7bbcb5 | 2016-12-01 11:38:52 -0500 | [diff] [blame] | 50 | retries: 120 |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 51 | delay: 30 |
| 52 | tags: |
| 53 | - skip_ansible_lint |