Merge "Improve vm ip search code to be more generic"
[releng/builder.git] / openstack-hot / generic-server.yaml
1 heat_template_version: 2016-04-08
2
3 parameters:
4     job_name:
5         type: string
6         description: Name of job running this template
7     silo:
8         type: string
9         default: vm
10         description: |
11             String to identify a Jenkins Master
12
13             Useful in scenarios where multiple Jenkins Masters might be
14             creating VMs in the same cloud to uniquely distinguish them.
15
16             TODO we should move to using tags once OpenStack Ocata which is
17             available to us with support for server tags properties.
18     ssh_key:
19         type: string
20         description: SSH Key name to use (Public key must exist in OpenStack)
21     index:
22         type: number
23     vm_flavor:
24         type: string
25         default: 1 GB General Purpose v1
26         description: OpenStack Flavor to use
27     vm_image:
28         type: string
29         description: VM Image to spin up
30
31 resources:
32     instance:
33         type: "OS::Nova::Server"
34         properties:
35             flavor: { get_param: vm_flavor }
36             image: { get_param: vm_image }
37             name:
38                 str_replace:
39                     template: SILO-JOB_NAME-VM_TYPE-INDEX
40                     params:
41                         "SILO": { get_param: silo }
42                         "JOB_NAME": { get_param: job_name }
43                         "VM_TYPE":
44                             str_split:
45                                 - ' - '
46                                 - { get_param: vm_image }
47                                 - 1
48                         "INDEX": { get_param: index }
49             networks:
50                 - network: RC-ODL
51             key_name: { get_param: ssh_key }
52             user_data: |
53                 #!/bin/bash
54                 git clone https://git.opendaylight.org/gerrit/releng/builder /builder
55                 /builder/jenkins-scripts/jenkins-init-script.sh
56
57 outputs:
58     ip:
59         description: IP address of the instance
60         value: { get_attr: [instance, networks, RC-ODL, 0] }