#!/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 {% for name, network in (undercloud_networks|default({})).items() if name == 'external' %} {% if not overcloud_ipv6|bool %} sudo bash -c 'cat < /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 }} {% else %} sudo bash -c 'cat < /etc/sysconfig/network-scripts/ifcfg-eth6 DEVICE=eth6 ONBOOT=yes BOOTPROTO=static IPADDR={{ network.address }} NETMASK={{ network.netmask }} IPV6ADDR={{ network.address6 }} IPV6INIT=yes EOF' sudo ifup ifcfg-eth6 {%endif%} {% endfor %} {%endif%} ### --stop_docs