Sapan Bhatia | d8e129a | 2014-11-19 15:26:11 -0500 | [diff] [blame] | 1 | --- |
| 2 | - hosts: 127.0.0.1 |
Sapan | d3e9617 | 2014-12-03 01:27:56 -0500 | [diff] [blame] | 3 | connection: local |
| 4 | tasks: |
Sapan Bhatia | ba746bd | 2014-12-19 14:10:42 -0500 | [diff] [blame] | 5 | {% if not delete %} |
Sapan | d3e9617 | 2014-12-03 01:27:56 -0500 | [diff] [blame] | 6 | - nova_keypair: |
| 7 | state: present |
| 8 | auth_url: {{ endpoint }} |
| 9 | login_username: {{ admin_user }} |
| 10 | login_password: {{ admin_password }} |
| 11 | login_tenant_name: {{ admin_tenant }} |
| 12 | name: {{ key_name }} |
| 13 | public_key: "{{ key.public_key}}" |
Sapan Bhatia | ba746bd | 2014-12-19 14:10:42 -0500 | [diff] [blame] | 14 | {% endif %} |
Sapan | d3e9617 | 2014-12-03 01:27:56 -0500 | [diff] [blame] | 15 | - nova_compute: |
Sapan | d3e9617 | 2014-12-03 01:27:56 -0500 | [diff] [blame] | 16 | auth_url: {{ endpoint }} |
| 17 | login_username: {{ admin_user }} |
| 18 | login_password: {{ admin_password }} |
| 19 | login_tenant_name: {{ admin_tenant }} |
Sapan | d3e9617 | 2014-12-03 01:27:56 -0500 | [diff] [blame] | 20 | name: {{ name }} |
Sapan Bhatia | ba746bd | 2014-12-19 14:10:42 -0500 | [diff] [blame] | 21 | {% if delete %} |
| 22 | state: absent |
| 23 | {% else %} |
| 24 | state: present |
| 25 | availability_zone: {{ availability_zone }} |
Sapan | d3e9617 | 2014-12-03 01:27:56 -0500 | [diff] [blame] | 26 | image_id: {{ image_id }} |
| 27 | key_name: {{ key_name }} |
| 28 | wait_for: 200 |
| 29 | flavor_id: {{ flavor_id }} |
| 30 | user_data: "{{ user_data }}" |
| 31 | nics: |
| 32 | {% for net in nics %} |
| 33 | - net-id: {{ net }} |
| 34 | {% endfor %} |
Sapan | 28b9c43 | 2014-12-03 00:03:56 -0500 | [diff] [blame] | 35 | |
Sapan | d3e9617 | 2014-12-03 01:27:56 -0500 | [diff] [blame] | 36 | {% if meta %} |
| 37 | meta: |
| 38 | {% for k,v in meta.items() %} |
| 39 | {{ k }} : "{{ v }}" |
| 40 | {% endfor %} |
| 41 | {% endif %} |
Sapan Bhatia | ba746bd | 2014-12-19 14:10:42 -0500 | [diff] [blame] | 42 | {% else %} |
| 43 | state: present |
| 44 | image_id: {{ image_id }} |
| 45 | key_name: {{ key_name }} |
| 46 | wait_for: 200 |
| 47 | flavor_id: {{ flavor_id }} |
| 48 | user_data: "{{ user_data }}" |
| 49 | nics: |
| 50 | {% for net in nics %} |
| 51 | - net-id: {{ net }} |
| 52 | {% endfor %} |
| 53 | |
| 54 | {% if meta %} |
| 55 | meta: |
| 56 | {% for k,v in meta.items() %} |
| 57 | {{ k }} : "{{ v }}" |
| 58 | {% endfor %} |
| 59 | {% endif %} |
| 60 | {% endif %} |