calculate subnet/netmask from cidr
[yaml_builds.git] / tools / j2 / serverrc.j2
1 ##############################################################################
2 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.        #
3 #                                                                            #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may    #
5 # not use this file except in compliance with the License.                   #
6 #                                                                            #
7 # You may obtain a copy of the License at                                    #
8 #       http://www.apache.org/licenses/LICENSE-2.0                           #
9 #                                                                            #
10 # Unless required by applicable law or agreed to in writing, software        #
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
13 # See the License for the specific language governing permissions and        #
14 # limitations under the License.                                             #
15 ##############################################################################
16
17 # Add proxy settings if required for your environment
18 # export http_proxy=http://your.proxy.com:8080/
19 # export https_proxy=http://your.proxy.com:8080/
20 #
21
22 # host name for server
23 SRV_NAME={{yaml.genesis.name}}
24
25 # out of band interface information for server (idrac/ilo/etc)
26 SRV_OOB_IP={{yaml.genesis.oob}}
27 SRV_OOB_USR={{yaml.ipmi_admin.username}}
28 SRV_OOB_PWD={{yaml.ipmi_admin.password}}
29
30 # mac address of server to be used during the build - not required for Dell servers
31 {% if 'mac_address' in yaml.genesis %}
32 SRV_MAC={{yaml.genesis.mac_address}}
33 {% endif %}
34
35 # the boot device is the device name on which the OS will be loaded
36 SRV_BOOT_DEVICE={{yaml.disks[0].name}}
37 SRV_CEPH_DEVICE={{yaml.disks[1].name}}
38
39 # ipxe script to use - based on the os version and kernel to install
40 # valid options are script-hwe-16.04.6-amd64.ipxe or script-16.04.6-amd64.ipxe
41 SRV_BLD_SCRIPT=script-hwe-16.04.6-amd64.ipxe
42
43 # template xml file to set bios and raid configuration settings
44 SRV_BIOS_TEMPLATE={% if 'bios_template' in yaml.genesis %}{{yaml.genesis.bios_template}}
45                   {% else %}{{yaml.hardware.bios_template}}
46                   {% endif %}
47 SRV_BOOT_TEMPLATE={% if 'boot_template' in yaml.genesis %}{{yaml.genesis.boot_template}}
48                   {% else %}{{yaml.hardware.boot_template}}
49                   {% endif %}
50 SRV_HTTP_BOOT_DEV={% if 'http_boot_device' in yaml.genesis %}{{yaml.genesis.http_boot_device}}
51                   {% else %}{{yaml.hardware.http_boot_device}}
52                   {% endif %}
53
54 # tempalte to run to configure OS after first boot
55 # current options are: firstboot.sh.template, firstboot-genesis.sh.tempate or firstboot-airship-iab.sh.template
56 SRV_FIRSTBOOT_TEMPLATE=firstboot-genesis.sh.template
57
58 # VLAN to use during build and for final network configuration
59 SRV_VLAN={{yaml.networks.host.vlan}}
60 SRV_STORAGE_VLAN={{yaml.networks.storage.vlan}}
61 SRV_CALICO_VLAN={{yaml.networks.ksn.vlan}}
62 SRV_NEUTRON_VLAN={{yaml.networks.neutron.vlan}}
63 SRV_PXE_INF={{yaml.networks.pxe.interface}}
64 SRV_VXLAN_INF={{yaml.networks.vxlan.interface}}
65
66 # basic network information for dhcp config and final server network settings
67 SRV_MTU=9000
68 SRV_IP={{yaml.genesis.host}}
69 SRV_STORAGE_IP={{yaml.genesis.storage}}
70 SRV_CALICO_IP={{yaml.genesis.ksn}}
71 SRV_NEUTRON_IP={{yaml.genesis.neutron}}
72 SRV_PXE_IP={{yaml.genesis.pxe}}
73 SRV_VXLAN_IP={{yaml.genesis.vxlan}}
74 SRV_SUBNET={{yaml.networks.host.cidr | cidr_subnet}}
75 SRV_NETMASK={{yaml.networks.host.cidr | cidr_netmask}}
76 SRV_GATEWAY={{yaml.networks.host.routes.gateway}}
77 SRV_DNS="{% if 'dns' in yaml.networks.host %}{{yaml.networks.host.dns.servers}}{% else %}{{yaml.dns.upstream_servers|join(' ')}}{% endif %}"
78 SRV_DOMAIN={% if 'dns' in yaml.networks.pxe and 'domain' in yaml.networks.pxe.dns %}{{yaml.networks.pxe.dns.domain}}
79            {% else %}{{yaml.dns.domain}}
80            {% endif %}
81 SRV_DNSSEARCH={% if 'dns' in yaml.networks.pxe and 'domain' in yaml.networks.pxe.dns %}{{yaml.networks.pxe.dns.domain}}
82               {% else %}{{yaml.dns.domain}}
83               {% endif %}
84 SRV_NTP=ntp.ubuntu.org
85
86 # root password for server being built
87 SRV_PWD={{yaml.genesis.root_password}}
88
89 # network bond information
90 SRV_BOND={{yaml.networks.primary}}
91 {% for slave in yaml.networks.slaves %}
92 SRV_SLAVE{{loop.index}}={{slave.name}}
93 {% endfor %}
94