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"] |
huangtianhua | 4dd1394 | 2016-11-21 16:09:50 +0800 | [diff] [blame] | 26 | user_data_format: |
| 27 | type: string |
| 28 | default: RAW |
Steve Baker | c2f84ee | 2016-06-30 00:56:13 +0000 | [diff] [blame] | 29 | resources: |
| 30 | sg: |
| 31 | type: OS::Neutron::SecurityGroup |
| 32 | properties: |
| 33 | name: the_sg |
| 34 | description: Ping and SSH |
| 35 | rules: |
| 36 | - protocol: icmp |
| 37 | - protocol: tcp |
| 38 | port_range_min: 22 |
| 39 | port_range_max: 22 |
| 40 | |
| 41 | floating_ip: |
| 42 | type: OS::Neutron::FloatingIP |
| 43 | properties: |
| 44 | floating_network: {get_param: public_net} |
| 45 | |
| 46 | network: |
| 47 | type: OS::Neutron::Net |
| 48 | |
| 49 | subnet: |
| 50 | type: OS::Neutron::Subnet |
| 51 | properties: |
| 52 | network: {get_resource: network} |
| 53 | ip_version: 4 |
| 54 | cidr: {get_param: subnet_cidr} |
| 55 | dns_nameservers: {get_param: dns_servers} |
| 56 | |
| 57 | router: |
| 58 | type: OS::Neutron::Router |
| 59 | properties: |
| 60 | external_gateway_info: |
| 61 | network: {get_param: public_net} |
| 62 | |
| 63 | router_interface: |
| 64 | type: OS::Neutron::RouterInterface |
| 65 | properties: |
| 66 | router: {get_resource: router} |
| 67 | subnet: {get_resource: subnet} |
| 68 | |
| 69 | wait_handle: |
| 70 | type: OS::Heat::WaitConditionHandle |
| 71 | |
| 72 | server: |
| 73 | type: OS::Nova::Server |
| 74 | properties: |
| 75 | image: {get_param: image} |
| 76 | flavor: {get_param: flavor} |
| 77 | key_name: {get_param: key_name} |
| 78 | networks: |
| 79 | - subnet: {get_resource: subnet} |
| 80 | security_groups: |
| 81 | - {get_resource: sg} |
huangtianhua | 4dd1394 | 2016-11-21 16:09:50 +0800 | [diff] [blame] | 82 | user_data_format: {get_param: user_data_format} |
Steve Baker | c2f84ee | 2016-06-30 00:56:13 +0000 | [diff] [blame] | 83 | user_data: |
| 84 | str_replace: |
| 85 | template: | |
| 86 | #!/bin/sh |
| 87 | wc_notify --data-binary '{"status": "SUCCESS", "data": "test complete"}' |
| 88 | params: |
| 89 | wc_notify: { get_attr: ['wait_handle', 'curl_cli'] } |
| 90 | |
| 91 | server_floating_ip_assoc: |
| 92 | type: OS::Neutron::FloatingIPAssociation |
| 93 | properties: |
| 94 | floatingip_id: {get_resource: floating_ip} |
| 95 | port_id: {get_attr: [server, addresses, {get_resource: network}, 0, port]} |
| 96 | |
| 97 | wait_condition: |
| 98 | type: OS::Heat::WaitCondition |
| 99 | properties: |
| 100 | handle: {get_resource: wait_handle} |
| 101 | timeout: {get_param: timeout} |
| 102 | |
| 103 | outputs: |
| 104 | server_ip: |
| 105 | value: {get_attr: [floating_ip, floating_ip_address]} |
| 106 | wc_data: |
| 107 | value: {get_attr: [wait_condition, data]} |