Do not run after_boot.sh by default
[samplevnf.git] / VNFs / DPPD-PROX / helper-scripts / rapid / openstack-rapid.yaml
1 heat_template_version: 2015-10-15
2
3 description: >
4   Template for deploying n PROX instances. The template allows for deploying
5   multiple groups of PROX VMs. You can create a first group with certain
6   flavors, availability groups, etc... Another group can be created with
7   different characteristics.
8
9 parameters:
10   public_net_name: {description: Public network to allocate (floating) IPs to VMs', type: string, default: admin_floating_net}
11   mgmt_net_name: {description: Name of PROX mgmt network to be created, type: string, default: admin_internal_net}
12   PROX_image: {description: Image name to use for PROX, type: string, default: rapidVM}
13   PROX_key: {description: DO NOT CHANGE THIS DEFAULT KEY NAME, type: string, default: rapid_rsa_key}
14   my_availability_zone: {description: availability_zone for Hosting VMs, type: string, default: nova}
15   security_group: {description: Security Group to use, type: string, default: prox_security_group}
16   PROXType1VM_count: {description: Total number of testVMs to create, type: number, default: 2}
17   PROXType2VM_count: {description: Total number of testVMs type 2 to create, type: number, default: 1}
18   PROXType3VM_count: {description: Total number of testVMs type 3 to create, type: number, default: 1}
19
20 # The following paramters are not used, but are here in case you want to also
21 # create the management and dataplane networks in this template
22   mgmt_net_cidr: {description: PROX mgmt network CIDR, type: string, default: 20.20.1.0/24}
23   mgmt_net_gw: {description: PROX mgmt network gateway address, type: string, default: 20.20.1.1}
24   mgmt_net_pool_start: {description: Start of mgmt network IP address allocation pool, type: string, default: 20.20.1.100}
25   mgmt_net_pool_end: {description: End of mgmt network IP address allocation pool, type: string, default: 20.20.1.200}
26   data_net_name: {description: Name of PROX private network to be created, type: string, default: dataplane-network}
27   data_net_cidr: {description: PROX private network CIDR,type: string, default: 30.30.1.0/24}
28   data_net_pool_start: {description: Start of private network IP address allocation pool, type: string, default: 30.30.1.100}
29   data_net_pool_end: {description: End of private network IP address allocation pool, type: string, default: 30.30.1.200}
30   data2_net_name: {description: Name of PROX private network 2 to be created, type: string, default: data2}
31   dns:
32     type: comma_delimited_list
33     label: DNS nameservers
34     description: Comma separated list of DNS nameservers for the management network.
35     default: '8.8.8.8'
36
37 resources:
38   PROXType1VMs:
39     type: OS::Heat::ResourceGroup
40     description: Group of PROX VMs according to specs described in this section
41     properties:
42       count: { get_param: PROXType1VM_count }
43       resource_def:
44         type: rapid-openstack-server.yaml
45         properties:
46           PROX_availability_zone : {get_param: my_availability_zone}
47           PROX_security_group : {get_param: security_group}
48           PROX_image: {get_param: PROX_image}
49           PROX_key: {get_param: PROX_key}
50           PROX_server_name: rapidVM-%index%
51           PROX_public_net: {get_param: public_net_name}
52           PROX_mgmt_net_id: {get_param: mgmt_net_name}
53           PROX_data_net_id: {get_param: data_net_name}
54           PROX_config: {get_resource: MyConfig}
55     depends_on:
56       - MyConfig
57  
58   PROXType2VMs:
59     type: OS::Heat::ResourceGroup
60     description: Group of PROX VMs according to specs described in this section
61     properties:
62       count: { get_param: PROXType2VM_count }
63       resource_def:
64         type: rapid-openstack-server-2ports.yaml
65         properties:
66           PROX_availability_zone : {get_param: my_availability_zone}
67           PROX_security_group : {get_param: security_group}
68           PROX_image: {get_param: PROX_image}
69           PROX_key: {get_param: PROX_key}
70           PROX_server_name: rapidType2VM-%index%
71           PROX_public_net: {get_param: public_net_name}
72           PROX_mgmt_net_id: {get_param: mgmt_net_name}
73           PROX_data_net_id: {get_param: data_net_name}
74           PROX_data2_net_id: {get_param: data2_net_name}
75           PROX_config: {get_resource: MyConfig}
76     depends_on:
77       - MyConfig
78  
79   PROXType3VMs:
80     type: OS::Heat::ResourceGroup
81     description: Group of PROX VMs according to specs described in this section
82     properties:
83       count: { get_param: PROXType3VM_count }
84       resource_def:
85         type: rapid-openstack-server.yaml
86         properties:
87           PROX_availability_zone : {get_param: my_availability_zone}
88           PROX_security_group : {get_param: security_group}
89           PROX_image: {get_param: PROX_image}
90           PROX_key: {get_param: PROX_key}
91           PROX_server_name: rapidType3VM-%index%
92           PROX_public_net: {get_param: public_net_name}
93           PROX_mgmt_net_id: {get_param: mgmt_net_name}
94           PROX_data_net_id: {get_param: data2_net_name}
95           PROX_config: {get_resource: MyConfig}
96     depends_on:
97       - MyConfig
98  
99   MyConfig:
100     type: OS::Heat::CloudConfig
101     properties:
102       cloud_config:
103         users:
104         - default
105         - name: rapid
106           groups: "users,root"
107           lock-passwd: false
108           passwd: 'test'
109           shell: "/bin/bash"
110           sudo: "ALL=(ALL) NOPASSWD:ALL"
111         ssh_pwauth: true
112         chpasswd:
113           list:  |
114               rapid:rapid
115           expire: False
116         write_files:
117         - path: /opt/rapid/after_boot_do_not_run.sh
118           # - path: /opt/rapid/after_boot.sh
119           # after_boot.sh is ran by check_prox_system_setup.sh, if it exists
120           # This can be used to fix some issues, like in the example below
121           # Remove this section or rename the file, if you do not want to run
122           # this after booting
123           # The code below is just an example of what could be ran after boot
124           content: |
125             OLDIFS="${IFS}"
126             IFS=$'\n'
127             list="$(ip route | grep via | grep -v 'dev eth0')"
128             # Delete all routes using gateway on other interfaces than eth0
129             for item in ${list}
130               do /bin/bash -c "sudo ip route del ${item}"
131             done
132             # Make sure to replace the IP address with your gateway
133             /bin/bash -c "sudo ip route add default via 10.6.6.1 dev eth0"
134             /bin/bash -c "echo nameserver 8.8.8.8 > /etc/resolv.conf"
135             IFS="${OLDIFS}"
136           permissions: '0777'
137
138 outputs:
139   number_of_servers:
140     description: List of number or PROX instance
141     value:
142       - {get_param: PROXType1VM_count}
143       - {get_param: PROXType2VM_count}
144       - {get_param: PROXType3VM_count}
145   server_name:
146     description: List of list of names of the PROX instances
147     value:
148       - {get_attr: [PROXType1VMs, name]}
149       - {get_attr: [PROXType2VMs, name]}
150       - {get_attr: [PROXType3VMs, name]}
151   mngmt_ips:
152     description: List of list of Management IPs of the VMs
153     value:
154       - {get_attr: [PROXType1VMs, mngmt_ip]}
155       - {get_attr: [PROXType2VMs, mngmt_ip]}
156       - {get_attr: [PROXType3VMs, mngmt_ip]}
157   data_plane_ips:
158     description: List of list of list of DataPlane IPs of the VMs
159     value:
160       - {get_attr: [PROXType1VMs, data_plane_ips]}
161       - {get_attr: [PROXType2VMs, data_plane_ips]}
162       - {get_attr: [PROXType3VMs, data_plane_ips]}
163   data_plane_macs:
164     description: List of list of list of DataPlane MACs of the VMs
165     value:
166       - {get_attr: [PROXType1VMs, data_plane_mac]}
167       - {get_attr: [PROXType2VMs, data_plane_mac]}
168       - {get_attr: [PROXType3VMs, data_plane_mac]}