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 |
Michal Zegan | 6425e67 | 2019-09-05 18:46:05 +0200 | [diff] [blame^] | 21 | scheduler_hints: |
| 22 | type: json |
| 23 | default: {} |
Michal Zegan | 07479cb | 2019-08-22 14:43:11 +0200 | [diff] [blame] | 24 | #Resources. |
| 25 | resources: |
| 26 | #This is the network port to attach instance to. |
| 27 | port: |
| 28 | type: OS::Neutron::Port |
| 29 | properties: |
| 30 | network: { get_param: network } |
| 31 | security_groups: [ { get_param: security_group } ] |
| 32 | fixed_ips: |
| 33 | - { subnet: { get_param: subnet }} |
| 34 | #cloudinit configuration stuff. |
| 35 | config: |
| 36 | type: OS::Heat::SoftwareConfig |
| 37 | properties: |
| 38 | config: |
| 39 | str_replace_strict: |
| 40 | template: { get_file: config.yaml } |
| 41 | params: |
| 42 | "%{NOTIFY_COMMAND}": { get_param: notify_command } |
| 43 | #Actual instance to create. |
| 44 | instance: |
| 45 | type: OS::Nova::Server |
| 46 | properties: |
| 47 | name: { get_param: instance_name } |
| 48 | image: { get_param: image_name } |
| 49 | flavor: { get_param: flavor_name } |
| 50 | key_name: { get_param: key_name } |
| 51 | networks: |
| 52 | - port: { get_resource: port } |
| 53 | user_data_format: SOFTWARE_CONFIG |
| 54 | user_data: { get_resource: config } |
Michal Zegan | 6425e67 | 2019-09-05 18:46:05 +0200 | [diff] [blame^] | 55 | scheduler_hints: { get_param: scheduler_hints } |
Michal Zegan | 07479cb | 2019-08-22 14:43:11 +0200 | [diff] [blame] | 56 | outputs: |
| 57 | OS::stack_id: |
| 58 | value: { get_resource: instance } |
| 59 | port_id: |
| 60 | value: { get_resource: port } |
| 61 | ip: |
| 62 | value: { get_attr: ["port", "fixed_ips", 0, "ip_address"] } |