| --- |
| - hosts: 127.0.0.1 |
| connection: local |
| tasks: |
| - shell: ENDPOINT={{endpoint_v3}} USERNAME={{admin_user}} PASSWORD={{admin_password}} TENANT=admin DOMAIN={{domain}} openstack/get_token.sh |
| register: token |
| |
| - nova_compute: |
| auth_url: {{ endpoint }} |
| token: {{ token.stdout }} |
| name: {{ name }} |
| {% if delete -%} |
| state: absent |
| {% else -%} |
| state: present |
| availability_zone: {{ availability_zone }} |
| image_name: {{ image_name }} |
| wait_for: 200 |
| flavor_name: {{ flavor_name }} |
| user_data: "{{ user_data }}" |
| nics: |
| {% for net in nics %} |
| - net-id: {{ net }} |
| {% endfor %} |
| {% for port in ports %} |
| - port-id: {{ port }} |
| {% endfor %} |
| |
| {% if meta %} |
| meta: |
| {% for k,v in meta.items() %} |
| {{ k }} : "{{ v }}" |
| {% endfor %} |
| {% endif %} |
| {% endif %} |