tripleo-quickstart-extras/roles/overcloud-prep-network/templates/overcloud-prep-network.sh.j2
Sagi Shnaidman bb1e2d34c0 Remove obsolete interface adding for ipv6
eth6 doesn't exist, don't configure it at all,
instead of this the external interface wil be configured
according to network-template.yaml file settings.

Change-Id: Ib4ef9ee5a8ed04273ec6614c33f953642ac22d7c
2017-06-27 20:52:24 +03:00

107 lines
3.1 KiB
Django/Jinja

#!/bin/bash
set -eux
### --start_docs
## Prepare network for deploying the overcloud
## ==================================================
## Prepare Your Environment
## ------------------------
## * Source in the undercloud credentials.
## ::
source {{ working_dir }}/stackrc
{% if network_isolation|bool %}
## Setup Networking
## ----------------
## * Enable NAT for "external" network.
## ::
RULE="-s {{undercloud_external_network_cidr}} ! -d {{undercloud_external_network_cidr}} -j MASQUERADE"
if ! sudo iptables -t nat -C BOOTSTACK_MASQ $RULE; then
sudo iptables -t nat -A BOOTSTACK_MASQ $RULE
sudo sh -c 'iptables-save > /etc/sysconfig/iptables'
fi
{% endif %}
{% if network_isolation|bool and network_isolation_type in ['single-nic-vlans', 'single_nic_vlans', 'bond-with-vlans', 'bond_with_vlans'] %}
{% if network_isolation_type in ['single_nic_vlans', 'bond_with_vlans'] %}
# NOTE: 'bond_with_vlans' and 'single_nic_vlans' are deprecated
echo "Network isolation types 'bond_with_vlans' and 'single_nic_vlans' are deprecated"
echo "Please use 'single-nic-vlans' and 'bond-with-vlans'"
{% endif %}
{% for name, network in (undercloud_networks|default({})).items() if name == 'external' %}
{% if not overcloud_ipv6|bool and network.device_type == 'ovs' %}
sudo bash -c 'cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-vlan{{ network.tag }}
DEVICE=vlan{{ network.tag }}
ONBOOT=yes
DEVICETYPE={{ network.device_type }}
TYPE={{ network.type }}
BOOTPROTO=static
IPADDR={{ network.address }}
NETMASK={{ network.netmask }}
OVS_BRIDGE={{ network.ovs_bridge }}
OVS_OPTIONS={{ network.ovs_options }}
EOF'
sudo ifup ifcfg-vlan{{ network.tag }}
{% elif network.device_type == 'ethernet' %}
sudo bash -c 'cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-{{ network.device_name }}
DEVICE={{ network.device_name }}
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR={{ network.address }}
NETMASK={{ network.netmask }}
EOF'
{% if overcloud_ipv6|bool %}
sudo bash -c 'cat <<EOF >> /etc/sysconfig/network-scripts/ifcfg-{{ network.device_name }}
IPV6ADDR={{ network.address6 }}
IPV6INIT=yes
EOF'
{%endif%}
sudo ifup ifcfg-{{ network.device_name }}
{%endif%}
{% endfor %}
{% elif not network_isolation|bool %}
## * Set the DNS server in the control plane network
## ::
# Set DNS server for the overcloud nodes
neutron subnet-update $(neutron net-list | awk '/ctlplane/{print $(NF-2) }') --dns-nameserver $(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }' | sed ':a;N;$!ba;s/\n/ --dns-nameserver /g')
{%endif%}
{% if enable_tls_everywhere|bool and overcloud_dns_servers and release not in ['mitaka', 'newton'] %}
## * Set the DNS server for the overcloud's ctlplane subnet. This will be used briefly before
## os-net-config runs in the overcloud nodes, but for TLS-everywhere, we need it for discovery to
## work in the FreeIPA enrollment.
## ::
CTLPLANE_SUBNET=$(openstack subnet show ctlplane-subnet -f value -c id)
neutron subnet-update $CTLPLANE_SUBNET \
{% for nameserver in overcloud_dns_servers %} --dns-nameserver "{{ nameserver }}" {% endfor %}
{% endif %}
### --stop_docs