| 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 |
user_data_format: |
| 27 |
type: string |
| 28 |
default: RAW |
| 29 |
wc_extra_args: |
| 30 |
type: string |
| 31 |
default: "" |
| 32 |
resources: |
| 33 |
sg: |
| 34 |
type: OS::Neutron::SecurityGroup |
| 35 |
properties: |
| 36 |
description: Ping and SSH |
| 37 |
rules: |
| 38 |
- protocol: icmp |
| 39 |
- protocol: tcp |
| 40 |
port_range_min: 22 |
| 41 |
port_range_max: 22 |
| 42 |
|
| 43 |
floating_ip: |
| 44 |
type: OS::Neutron::FloatingIP |
| 45 |
properties: |
| 46 |
floating_network: {get_param: public_net} |
| 47 |
|
| 48 |
network: |
| 49 |
type: OS::Neutron::Net |
| 50 |
|
| 51 |
subnet: |
| 52 |
type: OS::Neutron::Subnet |
| 53 |
properties: |
| 54 |
network: {get_resource: network} |
| 55 |
ip_version: 4 |
| 56 |
cidr: {get_param: subnet_cidr} |
| 57 |
dns_nameservers: {get_param: dns_servers} |
| 58 |
|
| 59 |
router: |
| 60 |
type: OS::Neutron::Router |
| 61 |
properties: |
| 62 |
external_gateway_info: |
| 63 |
network: {get_param: public_net} |
| 64 |
|
| 65 |
router_interface: |
| 66 |
type: OS::Neutron::RouterInterface |
| 67 |
properties: |
| 68 |
router: {get_resource: router} |
| 69 |
subnet: {get_resource: subnet} |
| 70 |
|
| 71 |
wait_handle: |
| 72 |
type: OS::Heat::WaitConditionHandle |
| 73 |
|
| 74 |
server: |
| 75 |
type: OS::Nova::Server |
| 76 |
properties: |
| 77 |
image: {get_param: image} |
| 78 |
flavor: {get_param: flavor} |
| 79 |
key_name: {get_param: key_name} |
| 80 |
networks: |
| 81 |
- subnet: {get_resource: subnet} |
| 82 |
security_groups: |
| 83 |
- {get_resource: sg} |
| 84 |
user_data_format: {get_param: user_data_format} |
| 85 |
user_data: |
| 86 |
str_replace: |
| 87 |
template: | |
| 88 |
#!/bin/sh |
| 89 |
while true; do |
| 90 |
wc_notify --data-binary '{"status": "SUCCESS", "data": "test complete"}' |
| 91 |
if [ $? -eq 0 ]; then |
| 92 |
break |
| 93 |
fi |
| 94 |
sleep 10 |
| 95 |
done |
| 96 |
params: |
| 97 |
wc_notify: |
| 98 |
list_join: |
| 99 |
- " " |
| 100 |
- [ get_attr: ['wait_handle', 'curl_cli'], get_param: wc_extra_args ] |
| 101 |
|
| 102 |
server_floating_ip_assoc: |
| 103 |
type: OS::Neutron::FloatingIPAssociation |
| 104 |
properties: |
| 105 |
floatingip_id: {get_resource: floating_ip} |
| 106 |
port_id: {get_attr: [server, addresses, {get_resource: network}, 0, port]} |
| 107 |
|
| 108 |
wait_condition: |
| 109 |
type: OS::Heat::WaitCondition |
| 110 |
depends_on: server |
| 111 |
properties: |
| 112 |
handle: {get_resource: wait_handle} |
| 113 |
timeout: {get_param: timeout} |
| 114 |
|
| 115 |
outputs: |
| 116 |
server_ip: |
| 117 |
value: {get_attr: [floating_ip, floating_ip_address]} |
| 118 |
wc_data: |
| 119 |
value: {get_attr: [wait_condition, data]} |