Merge "Configure the placement API's interface to use the internal endpoint"
[apex-tripleo-heat-templates.git] / ci / pingtests / scenario001-multinode.yaml
1 heat_template_version: ocata
2
3 description: >
4   HOT template to created resources deployed by scenario001.
5 parameters:
6   key_name:
7     type: string
8     description: Name of keypair to assign to servers
9     default: 'pingtest_key'
10   image:
11     type: string
12     description: Name of image to use for servers
13     default: 'pingtest_image'
14   public_net_name:
15     type: string
16     default: 'nova'
17     description: >
18       ID or name of public network for which floating IP addresses will be allocated
19   private_net_name:
20     type: string
21     description: Name of private network to be created
22     default: 'default-net'
23   private_net_cidr:
24     type: string
25     description: Private network address (CIDR notation)
26     default: '192.168.2.0/24'
27   private_net_gateway:
28     type: string
29     description: Private network gateway address
30     default: '192.168.2.1'
31   private_net_pool_start:
32     type: string
33     description: Start of private network IP address allocation pool
34     default: '192.168.2.100'
35   private_net_pool_end:
36     type: string
37     default: '192.168.2.200'
38     description: End of private network IP address allocation pool
39
40 resources:
41
42   key_pair:
43     type: OS::Nova::KeyPair
44     properties:
45       save_private_key: true
46       name: {get_param: key_name }
47
48   private_net:
49     type: OS::Neutron::Net
50     properties:
51       name: { get_param: private_net_name }
52
53   private_subnet:
54     type: OS::Neutron::Subnet
55     properties:
56       network_id: { get_resource: private_net }
57       cidr: { get_param: private_net_cidr }
58       gateway_ip: { get_param: private_net_gateway }
59       allocation_pools:
60         - start: { get_param: private_net_pool_start }
61           end: { get_param: private_net_pool_end }
62
63   router:
64     type: OS::Neutron::Router
65     properties:
66       external_gateway_info:
67         network: { get_param: public_net_name }
68
69   router_interface:
70     type: OS::Neutron::RouterInterface
71     properties:
72       router_id: { get_resource: router }
73       subnet_id: { get_resource: private_subnet }
74
75   volume1:
76     type: OS::Cinder::Volume
77     properties:
78       name: Volume1
79       image: { get_param: image }
80       size: 1
81
82   server1:
83     type: OS::Nova::Server
84     depends_on: volume1
85     properties:
86       name: Server1
87       block_device_mapping:
88         - device_name: vda
89           volume_id: { get_resource: volume1 }
90       flavor: { get_resource: test_flavor }
91       key_name: { get_resource: key_pair }
92       networks:
93         - port: { get_resource: server1_port }
94
95   server1_port:
96     type: OS::Neutron::Port
97     properties:
98       network_id: { get_resource: private_net }
99       fixed_ips:
100         - subnet_id: { get_resource: private_subnet }
101       security_groups: [{ get_resource: server_security_group }]
102
103   server1_floating_ip:
104     type: OS::Neutron::FloatingIP
105     # TODO: investigate why we need this depends_on and if we could
106     # replace it by router_id with get_resource: router_interface
107     depends_on: router_interface
108     properties:
109       floating_network: { get_param: public_net_name }
110       port_id: { get_resource: server1_port }
111
112   server_security_group:
113     type: OS::Neutron::SecurityGroup
114     properties:
115       description: Add security group rules for server
116       name: pingtest-security-group
117       rules:
118         - remote_ip_prefix: 0.0.0.0/0
119           protocol: tcp
120           port_range_min: 22
121           port_range_max: 22
122         - remote_ip_prefix: 0.0.0.0/0
123           protocol: icmp
124
125   test_flavor:
126     type: OS::Nova::Flavor
127     properties:
128       ram: 512
129       vcpus: 1
130
131 # Disabling this resource now
132 # https://bugs.launchpad.net/tripleo/+bug/1646506
133 #  gnocchi_res_alarm:
134 #    type: OS::Aodh::GnocchiResourcesAlarm
135 #    properties:
136 #      description: Do stuff with gnocchi
137 #      metric: cpu_util
138 #      aggregation_method: mean
139 #      granularity: 60
140 #      evaluation_periods: 1
141 #      threshold: 50
142 #      alarm_actions: []
143 #      resource_type: instance
144 #      resource_id: { get_resource: server1 }
145 #      comparison_operator: gt
146
147   asg:
148     type: OS::Heat::AutoScalingGroup
149     properties:
150       max_size: 5
151       min_size: 1
152       resource:
153         type: OS::Heat::RandomString
154
155   scaleup_policy:
156     type: OS::Heat::ScalingPolicy
157     properties:
158       adjustment_type: change_in_capacity
159       auto_scaling_group_id: {get_resource: asg}
160       cooldown: 0
161       scaling_adjustment: 1
162
163   alarm:
164     type: OS::Aodh::Alarm
165     properties:
166       description: Scale-up if the average CPU > 50% for 1 minute
167       meter_name: test_meter
168       statistic: count
169       comparison_operator: ge
170       threshold: 1
171       period: 60
172       evaluation_periods: 1
173       alarm_actions:
174         - {get_attr: [scaleup_policy, alarm_url]}
175       matching_metadata:
176         metadata.metering.stack_id: {get_param: "OS::stack_id"}
177
178 outputs:
179   server1_private_ip:
180     description: IP address of server1 in private network
181     value: { get_attr: [ server1, first_address ] }
182   server1_public_ip:
183     description: Floating IP address of server1 in public network
184     value: { get_attr: [ server1_floating_ip, floating_ip_address ] }
185   asg_size:
186     value: {get_attr: [asg, current_size]}