[CICDANSIBLE] Add availability_zone Heat stack parameter
[oom/offline-installer.git] / tools / cicdansible / heat / instance.yaml
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   scheduler_hints:
22     type: json
23     default: {}
24   demo_network:
25     type: string
26     default: ""
27   availability_zone:
28     type: string
29 conditions:
30   #Condition for demo network connection
31   connect_demo_net:
32     not:
33       equals:
34         - get_param: demo_network
35         - ""
36 #Resources.
37 resources:
38   #This is the network port to attach instance to.
39   port:
40     type: OS::Neutron::Port
41     properties:
42       network: { get_param: network }
43       security_groups: [ { get_param: security_group } ]
44       fixed_ips:
45         - { subnet: { get_param: subnet }}
46   #cloudinit configuration stuff.
47   config:
48     type: OS::Heat::SoftwareConfig
49     properties:
50       config:
51         str_replace_strict:
52           template: { get_file: config.yaml }
53           params:
54             "%{NOTIFY_COMMAND}": { get_param: notify_command }
55   #Actual instance to create.
56   instance:
57     type: OS::Nova::Server
58     properties:
59       name: { get_param: instance_name }
60       image: { get_param: image_name }
61       flavor: { get_param: flavor_name }
62       availability_zone: { get_param: availability_zone }
63       key_name: { get_param: key_name }
64       config_drive: true
65       networks:
66         if:
67         - "connect_demo_net"
68         - - port: { get_resource: port }
69           - network: { get_param: demo_network }
70         - - port: { get_resource: port }
71       user_data_format: SOFTWARE_CONFIG
72       user_data: { get_resource: config }
73       scheduler_hints: { get_param: scheduler_hints }
74 outputs:
75   OS::stack_id:
76     value: { get_resource: instance }
77   port_id:
78     value: { get_resource: port }
79   ip:
80     value: { get_attr: ["port", "fixed_ips", 0, "ip_address"] }