1037276d61
Also fix cleaning up node.extra and undeployment. Change-Id: Ic63b3663caea4eb9acd9d8f48008785dec2a62d3
79 lines
2.1 KiB
YAML
79 lines
2.1 KiB
YAML
- name: Create a port
|
|
command: openstack port create --network private test-port
|
|
when: precreate_port
|
|
|
|
- name: Set port argument
|
|
set_fact:
|
|
nic: --port test-port
|
|
when: precreate_port
|
|
|
|
- name: Set network argument
|
|
set_fact:
|
|
nic: --network private
|
|
when: not precreate_port
|
|
|
|
- name: Deploy a node
|
|
command: >
|
|
metalsmith --debug deploy
|
|
{{ nic }}
|
|
--image {{ image }}
|
|
--ssh-public-key {{ ssh_key_file }}
|
|
--root-disk-size 9
|
|
--netboot
|
|
baremetal
|
|
|
|
- name: Find the deployed node
|
|
command: openstack baremetal node list --provision-state active -f value -c UUID
|
|
register: active_node_result
|
|
|
|
- name: Check that the deployed node was found
|
|
fail:
|
|
msg: The deployed node cannot be found
|
|
when: active_node_result.stdout == ""
|
|
|
|
- name: Set active node fact
|
|
set_fact:
|
|
active_node: "{{ active_node_result.stdout }}"
|
|
|
|
- name: Show active node information
|
|
command: openstack baremetal node show {{ active_node }}
|
|
|
|
- name: Undeploy a node
|
|
command: metalsmith --debug undeploy {{ active_node }}
|
|
|
|
- name: Get the current status of the deployed node
|
|
command: openstack baremetal node show {{ active_node }} -f json
|
|
register: undeployed_node_result
|
|
|
|
- name: Parse node state
|
|
set_fact:
|
|
undeployed_node: "{{ undeployed_node_result.stdout | from_json }}"
|
|
|
|
- name: Check that the node was undeployed
|
|
fail:
|
|
msg: The node is in unexpected status {{ undeployed_node }}
|
|
when: undeployed_node.provision_state != "available"
|
|
|
|
- name: Check that the node extra was cleared
|
|
fail:
|
|
msg: The node still has extra {{ undeployed_node }}
|
|
when: undeployed_node.extra != {}
|
|
|
|
- name: Get attached VIFs for the node
|
|
command: openstack baremetal node vif list {{ active_node }} -f value -c ID
|
|
register: vif_list_output
|
|
|
|
- name: Check that no VIFs are still attached
|
|
fail:
|
|
msg: Some VIFs are still attached
|
|
when: vif_list_output.stdout != ""
|
|
|
|
- name: Show remaining ports
|
|
command: openstack port list
|
|
|
|
- name: Delete created port
|
|
command: openstack port delete test-port
|
|
when: precreate_port
|
|
# FIXME(dtantsur): fails because of ironic mis-behavior
|
|
ignore_errors: true
|