ricolin | c756e71 | 2017-04-06 22:50:10 +0800 | [diff] [blame^] | 1 | heat_template_version: 2014-10-16 |
| 2 | |
| 3 | description: > |
| 4 | This HOT template that just defines a single server. |
| 5 | Contains just base features to verify base heat support. |
| 6 | |
| 7 | parameters: |
| 8 | key_name: |
| 9 | type: string |
| 10 | default: key-01 |
| 11 | description: Name of an existing key pair to use for the server |
| 12 | flavor: |
| 13 | type: string |
| 14 | description: Flavor for the server to be created |
| 15 | default: m1.small |
| 16 | constraints: |
| 17 | - custom_constraint: nova.flavor |
| 18 | image: |
| 19 | type: string |
| 20 | description: Image ID or image name to use for the server |
| 21 | constraints: |
| 22 | - custom_constraint: glance.image |
| 23 | vol_size: |
| 24 | type: number |
| 25 | description: The size of the Cinder volume |
| 26 | default: 1 |
| 27 | private_net_name: |
| 28 | type: string |
| 29 | default: private-net-01 |
| 30 | description: Name of private network to be created |
| 31 | private_net_cidr: |
| 32 | type: string |
| 33 | default: 192.168.101.0/24 |
| 34 | description: Private network address (CIDR notation) |
| 35 | private_net_gateway: |
| 36 | type: string |
| 37 | default: 192.168.101.1 |
| 38 | description: Private network gateway address |
| 39 | private_net_pool_start: |
| 40 | type: string |
| 41 | default: 192.168.101.2 |
| 42 | description: Start of private network IP address allocation pool |
| 43 | private_net_pool_end: |
| 44 | type: string |
| 45 | default: 192.168.101.127 |
| 46 | description: End of private network IP address allocation pool |
| 47 | echo_foo: |
| 48 | default: fooooo |
| 49 | type: string |
| 50 | |
| 51 | resources: |
| 52 | private_net: |
| 53 | type: OS::Neutron::Net |
| 54 | properties: |
| 55 | name: { get_param: private_net_name } |
| 56 | |
| 57 | private_subnet: |
| 58 | type: OS::Neutron::Subnet |
| 59 | properties: |
| 60 | network_id: { get_resource: private_net } |
| 61 | cidr: { get_param: private_net_cidr } |
| 62 | gateway_ip: { get_param: private_net_gateway } |
| 63 | allocation_pools: |
| 64 | - start: { get_param: private_net_pool_start } |
| 65 | end: { get_param: private_net_pool_end } |
| 66 | |
| 67 | server_port: |
| 68 | type: OS::Neutron::Port |
| 69 | properties: |
| 70 | network_id: { get_resource: private_net } |
| 71 | fixed_ips: |
| 72 | - subnet_id: { get_resource: private_subnet } |
| 73 | |
| 74 | key: |
| 75 | type: OS::Nova::KeyPair |
| 76 | properties: |
| 77 | name: { get_param: key_name } |
| 78 | |
| 79 | server: |
| 80 | type: OS::Nova::Server |
| 81 | properties: |
| 82 | key_name: { get_resource: key } |
| 83 | image: { get_param: image } |
| 84 | flavor: { get_param: flavor } |
| 85 | networks: |
| 86 | - port: { get_resource: server_port } |
| 87 | user_data: |
| 88 | str_replace: |
| 89 | template: | |
| 90 | #!/bin/bash |
| 91 | echo echo_foo |
| 92 | params: |
| 93 | echo_foo: { get_param: echo_foo } |
| 94 | |
| 95 | vol: |
| 96 | type: OS::Cinder::Volume |
| 97 | properties: |
| 98 | size: { get_param: vol_size } |
| 99 | |
| 100 | vol_att: |
| 101 | type: OS::Cinder::VolumeAttachment |
| 102 | properties: |
| 103 | instance_uuid: { get_resource: server } |
| 104 | volume_id: { get_resource: vol } |
| 105 | mountpoint: /dev/vdb |
| 106 | |
| 107 | outputs: |
| 108 | server_networks: |
| 109 | description: The networks of the deployed server |
| 110 | value: { get_attr: [server, networks] } |