17792cd134e1694bbf55d80d18c5e1a7119986f3
[apex-tripleo-heat-templates.git] / ci / pingtests / scenario004-multinode.yaml
1 heat_template_version: 2013-05-23
2
3 description: >
4   HOT template to created resources deployed by scenario004.
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   server1:
76     type: OS::Nova::Server
77     properties:
78       name: Server1
79       flavor: { get_resource: test_flavor }
80       image: { get_param: image }
81       key_name: { get_resource: key_pair }
82       networks:
83         - port: { get_resource: server1_port }
84
85   server1_port:
86     type: OS::Neutron::Port
87     properties:
88       network_id: { get_resource: private_net }
89       fixed_ips:
90         - subnet_id: { get_resource: private_subnet }
91       security_groups: [{ get_resource: server_security_group }]
92
93   server1_floating_ip:
94     type: OS::Neutron::FloatingIP
95     # TODO: investigate why we need this depends_on and if we could
96     # replace it by router_id with get_resource: router_interface
97     depends_on: router_interface
98     properties:
99       floating_network: { get_param: public_net_name }
100       port_id: { get_resource: server1_port }
101
102   server_security_group:
103     type: OS::Neutron::SecurityGroup
104     properties:
105       description: Add security group rules for server
106       name: pingtest-security-group
107       rules:
108         - remote_ip_prefix: 0.0.0.0/0
109           protocol: tcp
110           port_range_min: 22
111           port_range_max: 22
112         - remote_ip_prefix: 0.0.0.0/0
113           protocol: icmp
114
115   test_flavor:
116     type: OS::Nova::Flavor
117     properties:
118       ram: 512
119       vcpus: 1
120
121 outputs:
122   server1_private_ip:
123     description: IP address of server1 in private network
124     value: { get_attr: [ server1, first_address ] }
125   server1_public_ip:
126     description: Floating IP address of server1 in public network
127     value: { get_attr: [ server1_floating_ip, floating_ip_address ] }