96a7582143
The IP addresses for the dhcp-relay service on the provision networks need to be fixed. If we end up using an address on the dhcp-relay instance that overlaps the address range in the Undercloud's provisioning networks we end up with conflicts.
190 lines
5.6 KiB
YAML
190 lines
5.6 KiB
YAML
heat_template_version: 2016-10-14
|
|
|
|
parameters:
|
|
|
|
key_name:
|
|
type: string
|
|
default: default
|
|
description: Nova keypair to inject into the undercloud and bmc
|
|
|
|
dhcp_relay_flavor:
|
|
type: string
|
|
default: m1.small
|
|
description: The Nova flavor to use for the dhcrelay instance
|
|
|
|
dhcp_relay_image:
|
|
type: string
|
|
default: CentOS-7-x86_64-GenericCloud
|
|
description: |
|
|
The base image for the dhcrelay instance. A CentOS 7 image is currently
|
|
the only one supported.
|
|
|
|
dhcp_relay_provision_address:
|
|
type: string
|
|
description: DHCP relay address on the provision network subnet
|
|
default: 192.168.24.253
|
|
|
|
dhcp_relay_provision2_address:
|
|
type: string
|
|
description: DHCP relay address on the provision2 network subnet
|
|
default: 192.168.25.253
|
|
|
|
dhcp_relay_provision3_address:
|
|
type: string
|
|
description: DHCP relay address on the provision3 network subnet
|
|
default: 192.168.26.253
|
|
|
|
dhcp_ips:
|
|
type: json
|
|
description: |
|
|
The IP addresses of DHCP servers to relay DHCP requests to.
|
|
|
|
networks:
|
|
type: json
|
|
|
|
private_net:
|
|
type: string
|
|
|
|
|
|
resources:
|
|
dhcp_relay_port_private:
|
|
type: OS::Neutron::Port
|
|
properties:
|
|
name: dhcp_relay_port_private
|
|
network: {get_param: private_net}
|
|
|
|
dhcp_relay_port_provision:
|
|
type: OS::Neutron::Port
|
|
properties:
|
|
name: dhcp_relay_port_provision
|
|
network: {get_param: [networks, provision]}
|
|
port_security_enabled: False
|
|
fixed_ips:
|
|
- ip_address: {get_param: dhcp_relay_provision_address}
|
|
|
|
dhcp_relay_port_provision2:
|
|
type: OS::Neutron::Port
|
|
properties:
|
|
name: dhcp_relay_port_provision2
|
|
network: {get_param: [networks, provision2]}
|
|
port_security_enabled: False
|
|
fixed_ips:
|
|
- ip_address: {get_param: dhcp_relay_provision2_address}
|
|
|
|
dhcp_relay_port_provision3:
|
|
type: OS::Neutron::Port
|
|
properties:
|
|
name: dhcp_relay_port_provision3
|
|
network: {get_param: [networks, provision3]}
|
|
port_security_enabled: False
|
|
fixed_ips:
|
|
- ip_address: {get_param: dhcp_relay_provision3_address}
|
|
|
|
init_networks:
|
|
type: OS::Heat::CloudConfig
|
|
properties:
|
|
cloud_config:
|
|
network:
|
|
version: 2
|
|
ethernets:
|
|
eth0:
|
|
dhcp4: false
|
|
addresses:
|
|
- list_join:
|
|
- /
|
|
- - {get_attr: [dhcp_relay_port_provision, fixed_ips, 0, ip_address]}
|
|
- {str_split: ['/', {get_attr: [dhcp_relay_port_provision, subnets, 0, cidr]}, 1]}
|
|
eth1:
|
|
dhcp4: false
|
|
addresses:
|
|
- list_join:
|
|
- /
|
|
- - {get_attr: [dhcp_relay_port_provision2, fixed_ips, 0, ip_address]}
|
|
- {str_split: ['/', {get_attr: [dhcp_relay_port_provision2, subnets, 0, cidr]}, 1]}
|
|
eth2:
|
|
dhcp4: false
|
|
addresses:
|
|
- list_join:
|
|
- /
|
|
- - {get_attr: [dhcp_relay_port_provision3, fixed_ips, 0, ip_address]}
|
|
- {str_split: ['/', {get_attr: [dhcp_relay_port_provision3, subnets, 0, cidr]}, 1]}
|
|
eth3:
|
|
dhcp4: true
|
|
|
|
init_packages:
|
|
type: OS::Heat::CloudConfig
|
|
properties:
|
|
cloud_config:
|
|
package_upgrade: true
|
|
packages:
|
|
- dhcp
|
|
|
|
init_files:
|
|
type: OS::Heat::CloudConfig
|
|
properties:
|
|
cloud_config:
|
|
write_files:
|
|
- path: /etc/systemd/system/dhcrelay.service
|
|
content:
|
|
str_replace:
|
|
template: |
|
|
[Unit]
|
|
Description=DHCP Relay Agent Daemon
|
|
Documentation=man:dhcrelay(8)
|
|
Wants=network-online.target
|
|
After=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
ExecStart=/usr/sbin/dhcrelay -d --no-pid $dhcp_ips -i eth1 -i eth2 -i eth3
|
|
StandardError=null
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
params:
|
|
$dhcp_ips:
|
|
list_join:
|
|
- ' '
|
|
- {get_param: dhcp_ips}
|
|
- path: /etc/sysctl.d/98-rp-filter.conf
|
|
content: |
|
|
net.ipv4.conf.eth1.rp_filter = 0
|
|
net.ipv4.conf.eth2.rp_filter = 0
|
|
net.ipv4.conf.eth3.rp_filter = 0
|
|
|
|
init_runcmd:
|
|
type: OS::Heat::CloudConfig
|
|
properties:
|
|
cloud_config:
|
|
runcmd:
|
|
- ['sysctl','--system']
|
|
- ['systemctl', 'daemon-reload']
|
|
- ['systemctl', 'enable', 'dhcrelay.service']
|
|
- ['systemctl', 'start', 'dhcrelay.service']
|
|
- ['systemctl', 'status', 'dhcrelay.service']
|
|
|
|
dhcrelay_init:
|
|
type: OS::Heat::MultipartMime
|
|
properties:
|
|
parts:
|
|
- config: {get_resource: init_networks}
|
|
- config: {get_resource: init_packages}
|
|
- config: {get_resource: init_files}
|
|
- config: {get_resource: init_runcmd}
|
|
|
|
dhcp_relay_server:
|
|
type: OS::Nova::Server
|
|
properties:
|
|
name: dhcrelay
|
|
flavor: {get_param: dhcp_relay_flavor}
|
|
image: {get_param: dhcp_relay_image}
|
|
key_name: {get_param: key_name}
|
|
networks:
|
|
- {port: {get_resource: dhcp_relay_port_private}}
|
|
- {port: {get_resource: dhcp_relay_port_provision}}
|
|
- {port: {get_resource: dhcp_relay_port_provision2}}
|
|
- {port: {get_resource: dhcp_relay_port_provision3}}
|
|
config_drive: true
|
|
user_data_format: RAW
|
|
user_data: {get_resource: dhcrelay_init}
|