Michal Zegan | 07479cb | 2019-08-22 14:43:11 +0200 | [diff] [blame] | 1 | #Template for instances. |
| 2 | heat_template_version: 2017-02-24 |
| 3 | description: "template instantiating and configuring a single instance (any)" |
| 4 | parameters: |
| 5 | instance_name: |
| 6 | type: string |
| 7 | network: |
| 8 | type: string |
| 9 | subnet: |
| 10 | type: string |
| 11 | image_name: |
| 12 | type: string |
| 13 | flavor_name: |
| 14 | type: string |
| 15 | key_name: |
| 16 | type: string |
| 17 | notify_command: |
| 18 | type: string |
| 19 | security_group: |
| 20 | type: string |
| 21 | #Resources. |
| 22 | resources: |
| 23 | #This is the network port to attach instance to. |
| 24 | port: |
| 25 | type: OS::Neutron::Port |
| 26 | properties: |
| 27 | network: { get_param: network } |
| 28 | security_groups: [ { get_param: security_group } ] |
| 29 | fixed_ips: |
| 30 | - { subnet: { get_param: subnet }} |
| 31 | #cloudinit configuration stuff. |
| 32 | config: |
| 33 | type: OS::Heat::SoftwareConfig |
| 34 | properties: |
| 35 | config: |
| 36 | str_replace_strict: |
| 37 | template: { get_file: config.yaml } |
| 38 | params: |
| 39 | "%{NOTIFY_COMMAND}": { get_param: notify_command } |
| 40 | #Actual instance to create. |
| 41 | instance: |
| 42 | type: OS::Nova::Server |
| 43 | properties: |
| 44 | name: { get_param: instance_name } |
| 45 | image: { get_param: image_name } |
| 46 | flavor: { get_param: flavor_name } |
| 47 | key_name: { get_param: key_name } |
| 48 | networks: |
| 49 | - port: { get_resource: port } |
| 50 | user_data_format: SOFTWARE_CONFIG |
| 51 | user_data: { get_resource: config } |
| 52 | outputs: |
| 53 | OS::stack_id: |
| 54 | value: { get_resource: instance } |
| 55 | port_id: |
| 56 | value: { get_resource: port } |
| 57 | ip: |
| 58 | value: { get_attr: ["port", "fixed_ips", 0, "ip_address"] } |