Steve Baker | c2f84ee | 2016-06-30 00:56:13 +0000 | [diff] [blame] | 1 | heat_template_version: 2013-05-23 |
| 2 | description: | |
| 3 | Template which uses a wait condition to confirm that a minimal |
| 4 | signalling works in a created network |
| 5 | parameters: |
| 6 | key_name: |
| 7 | type: string |
| 8 | flavor: |
| 9 | type: string |
| 10 | image: |
| 11 | type: string |
| 12 | subnet_cidr: |
| 13 | type: string |
| 14 | default: 10.100.0.0/16 |
| 15 | timeout: |
| 16 | type: number |
| 17 | public_net: |
| 18 | type: string |
| 19 | default: public |
| 20 | private_net: |
| 21 | type: string |
| 22 | default: heat-net |
| 23 | dns_servers: |
| 24 | type: comma_delimited_list |
| 25 | default: ["8.8.8.8", "8.8.4.4"] |
| 26 | resources: |
| 27 | sg: |
| 28 | type: OS::Neutron::SecurityGroup |
| 29 | properties: |
| 30 | name: the_sg |
| 31 | description: Ping and SSH |
| 32 | rules: |
| 33 | - protocol: icmp |
| 34 | - protocol: tcp |
| 35 | port_range_min: 22 |
| 36 | port_range_max: 22 |
| 37 | |
| 38 | floating_ip: |
| 39 | type: OS::Neutron::FloatingIP |
| 40 | properties: |
| 41 | floating_network: {get_param: public_net} |
| 42 | |
| 43 | network: |
| 44 | type: OS::Neutron::Net |
| 45 | |
| 46 | subnet: |
| 47 | type: OS::Neutron::Subnet |
| 48 | properties: |
| 49 | network: {get_resource: network} |
| 50 | ip_version: 4 |
| 51 | cidr: {get_param: subnet_cidr} |
| 52 | dns_nameservers: {get_param: dns_servers} |
| 53 | |
| 54 | router: |
| 55 | type: OS::Neutron::Router |
| 56 | properties: |
| 57 | external_gateway_info: |
| 58 | network: {get_param: public_net} |
| 59 | |
| 60 | router_interface: |
| 61 | type: OS::Neutron::RouterInterface |
| 62 | properties: |
| 63 | router: {get_resource: router} |
| 64 | subnet: {get_resource: subnet} |
| 65 | |
| 66 | wait_handle: |
| 67 | type: OS::Heat::WaitConditionHandle |
| 68 | |
| 69 | server: |
| 70 | type: OS::Nova::Server |
| 71 | properties: |
| 72 | image: {get_param: image} |
| 73 | flavor: {get_param: flavor} |
| 74 | key_name: {get_param: key_name} |
| 75 | networks: |
| 76 | - subnet: {get_resource: subnet} |
| 77 | security_groups: |
| 78 | - {get_resource: sg} |
| 79 | user_data_format: RAW |
| 80 | user_data: |
| 81 | str_replace: |
| 82 | template: | |
| 83 | #!/bin/sh |
| 84 | wc_notify --data-binary '{"status": "SUCCESS", "data": "test complete"}' |
| 85 | params: |
| 86 | wc_notify: { get_attr: ['wait_handle', 'curl_cli'] } |
| 87 | |
| 88 | server_floating_ip_assoc: |
| 89 | type: OS::Neutron::FloatingIPAssociation |
| 90 | properties: |
| 91 | floatingip_id: {get_resource: floating_ip} |
| 92 | port_id: {get_attr: [server, addresses, {get_resource: network}, 0, port]} |
| 93 | |
| 94 | wait_condition: |
| 95 | type: OS::Heat::WaitCondition |
| 96 | properties: |
| 97 | handle: {get_resource: wait_handle} |
| 98 | timeout: {get_param: timeout} |
| 99 | |
| 100 | outputs: |
| 101 | server_ip: |
| 102 | value: {get_attr: [floating_ip, floating_ip_address]} |
| 103 | wc_data: |
| 104 | value: {get_attr: [wait_condition, data]} |