| |
| # Copyright 2017-present Open Networking Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| |
| # Doesn't seem to be a MAAS module for Ansible yet |
| - name: Get MAAS credentials |
| become: yes |
| command: maas-region-admin apikey --username=cord |
| register: maas_key |
| tags: |
| - skip_ansible_lint |
| |
| - name: Login to MAAS |
| command: maas login cord http://localhost/MAAS/api/1.0 {{ maas_key.stdout }} |
| tags: |
| - skip_ansible_lint |
| |
| - name: Wait for node to become ready |
| shell: maas cord nodes list|jq -r '.[] | select(.status == 0).system_id' |
| register: nodeid |
| until: nodeid.stdout |
| retries: 40 |
| delay: 15 |
| tags: |
| - skip_ansible_lint |
| |
| # We need to be able to reboot the VM on the physical server running CiaB |
| - name: Add remote power state |
| 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 }}" |
| tags: |
| - skip_ansible_lint |
| |
| - name: Wait for node to be fully provisioned |
| become: yes |
| shell: /usr/local/bin/get-node-prov-state |jq '.[] | select(.id == "{{ nodeid.stdout }}").status' |
| register: prov_state |
| until: prov_state.stdout == "2" |
| retries: 120 |
| delay: 30 |
| tags: |
| - skip_ansible_lint |