Oleh Hryhorov | 207137d | 2021-04-13 12:03:39 +0300 | [diff] [blame^] | 1 | resource_registry: |
| 2 | "MCP2::CentralSite": ../fragments/multirack/CentralSite.yaml |
| 3 | "MCP2::Rack": ../fragments/multirack/Rack.yaml |
| 4 | "MCP2::RackRouterRoutes": ../fragments/multirack/RackRouterRoutes.yaml |
| 5 | |
| 6 | parameters: |
| 7 | image: bionic-server-cloudimg-amd64-20190612 |
| 8 | public_net_id: public |
| 9 | main_worker_size: 5 |
| 10 | rack01_cmp_size: 1 |
| 11 | rack02_cmp_size: 1 |
| 12 | cluster_public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCp0evjOaK8c8SKYK4r2+0BN7g+8YSvQ2n8nFgOURCyvkJqOHi1qPGZmuN0CclYVdVuZiXbWw3VxRbSW3EH736VzgY1U0JmoTiSamzLHaWsXvEIW8VCi7boli539QJP0ikJiBaNAgZILyCrVPN+A6mfqtacs1KXdZ0zlMq1BPtFciR1JTCRcVs5vP2Wwz5QtY2jMIh3aiwkePjMTQPcfmh1TkOlxYu5IbQyZ3G1ahA0mNKI9a0dtF282av/F6pwB/N1R1nEZ/9VtcN2I1mf1NW/tTHEEcTzXYo1R/8K9vlqAN8QvvGLZtZduGviNVNoNWvoxaXxDt8CPv2B2NCdQFZp |
| 13 | tunnel_interface: 'ens3' |
| 14 | main_worker_metadata: {"labels": {"openstack-control-plane":"enabled","openvswitch":"enabled","openstack-gateway": "enabled","role":"ceph-osd-node","local-volume-provisioner": "enabled"}} |
| 15 | rack01_cmp_metadata: {"labels": {"openstack-compute-node":"enabled","openvswitch":"enabled"}} |
| 16 | rack02_cmp_metadata: {"labels": {"openstack-compute-node":"enabled","openvswitch":"enabled"}} |
| 17 | # hardware_metadata which is used for Ceph requires flavor with |
| 18 | # ephemeral storage because it is used for Ceph bluestore. |
| 19 | main_worker_flavor: 'system.compact.openstack.control.ephemeral' |
| 20 | rack01_cmp_flavor: 'system.compact.openstack.control.ephemeral' |
| 21 | docker_ucp_image: docker-dev-kaas-local.docker.mirantis.net/lcm/docker/ucp:3.3.3 |
| 22 | docker_ee_url: https://storebits.docker.com/ubuntu |
| 23 | docker_ee_release: stable-19.03 |
| 24 | private_floating_interface: 'ens4' |
| 25 | rack_private_floating_interface: 'veth-phy' |
| 26 | main_worker_hardware_metadata: | |
| 27 | '00:00:00:00:00:00': |
| 28 | write_files: |
| 29 | - path: /usr/share/metadata/ceph.yaml |
| 30 | content: | |
| 31 | storageDevices: |
| 32 | - name: vdb |
| 33 | role: hdd |
| 34 | sizeGb: 20 |
| 35 | ramGb: 8 |
| 36 | cores: 2 |
| 37 | # The roles will be assigned based on node labels. |
| 38 | # roles: |
| 39 | # - mon |
| 40 | # - mgr |
| 41 | ips: |
| 42 | - 192.168.122.101 |
| 43 | crushPath: {} |
| 44 | |
| 45 | rack_functions_override: | |
| 46 | |
| 47 | function network_config { |
| 48 | PUBLIC_NODE_IP_ADDRESS=${PUBLIC_INTERFACE_IP:-$(ip addr show dev ${PUBLIC_INTERFACE} | grep -Po 'inet \K[\d.]+' | egrep -v "127.0.|172.17")} |
| 49 | PUBLIC_NODE_IP_NETMASK=${PUBLIC_INTERFACE_NETMASK:-$(ip addr show dev ${PUBLIC_INTERFACE} | grep -Po 'inet \K[\d.]+\/[\d]+' | egrep -v "127.0.|172.17" | cut -d'/' -f2)} |
| 50 | |
| 51 | local public_interface=${1:-${PUBLIC_INTERFACE}} |
| 52 | local cloud_netplan_cfg="/etc/netplan/50-cloud-init.yaml" |
| 53 | local match_ip_line |
| 54 | |
| 55 | DEBIAN_FRONTEND=noninteractive apt -y install bridge-utils |
| 56 | |
| 57 | cat << EOF > /etc/systemd/network/10-veth-phy-br.netdev |
| 58 | [NetDev] |
| 59 | Name=veth-phy |
| 60 | Kind=veth |
| 61 | [Peer] |
| 62 | Name=veth-br |
| 63 | EOF |
| 64 | |
| 65 | sed -i 's/.*ethernets:.*/&\n veth-phy: {}/' ${cloud_netplan_cfg} |
| 66 | sed -i 's/.*ethernets:.*/&\n veth-br: {}/' ${cloud_netplan_cfg} |
| 67 | |
| 68 | public_address_match_ip_line=$(grep -nm1 "${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK}" ${cloud_netplan_cfg} | cut -d: -f1) |
| 69 | sed -i "$((${public_address_match_ip_line}-1)),$((${public_address_match_ip_line}))d" ${cloud_netplan_cfg} |
| 70 | |
| 71 | cat << EOF >> ${cloud_netplan_cfg} |
| 72 | bridges: |
| 73 | br-public: |
| 74 | dhcp4: false |
| 75 | EOF |
| 76 | |
| 77 | # Remove Tunnel interface from netplan |
| 78 | if [[ $TUNNEL_INTERFACE_NETPLAN_MANAGE == false ]]; then |
| 79 | sed -i "/ ${TUNNEL_INTERFACE}/,/ set-name: ${TUNNEL_INTERFACE}/d" ${cloud_netplan_cfg} |
| 80 | fi |
| 81 | |
| 82 | netplan --debug apply |
| 83 | |
| 84 | # NOTE(vsaienko): give some time to apply changes |
| 85 | sleep 15 |
| 86 | |
| 87 | # Remove Tunnel interface from netplan |
| 88 | if [[ $TUNNEL_INTERFACE_NETPLAN_MANAGE == false ]]; then |
| 89 | ip addr flush ${TUNNEL_INTERFACE} |
| 90 | ip link set ${TUNNEL_INTERFACE} up |
| 91 | fi |
| 92 | |
| 93 | } |