From bc1786a24447121b5005492aaea8ca786135be29 Mon Sep 17 00:00:00 2001 From: Rihab Banday Date: Mon, 31 May 2021 20:23:21 +0200 Subject: Add initial config to support deployments on VMs * Add initial version of PDF and IDF that will be consumed by the hardware provisioner used in Kuberef to bring up libvirt VMs (for now 2 VMs for dev purposes). * Add deploy_on_vms.sh script to deploy Kuberef on VMs * Add new functions referenced by the deploy_on_vms.sh script - these can be merged with existing functions * Modify some of te BMRA templates to accomodate new changes. This has been tested on Ubuntu 18.04 baremetal server. Change-Id: I95a5e85cdab95befd24a1cae9f367b32ce26621e Signed-off-by: Rihab Banday Reviewed-on: https://gerrit.opnfv.org/gerrit/c/kuberef/+/72621 Tested-by: jenkins-ci Reviewed-by: Michael Pedersen Reviewed-by: Georg Kunz --- .../configure-vms/templates/Debian.interface.j2 | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 playbooks/roles/configure-vms/templates/Debian.interface.j2 (limited to 'playbooks/roles/configure-vms/templates') diff --git a/playbooks/roles/configure-vms/templates/Debian.interface.j2 b/playbooks/roles/configure-vms/templates/Debian.interface.j2 new file mode 100644 index 0000000..ef1a9fd --- /dev/null +++ b/playbooks/roles/configure-vms/templates/Debian.interface.j2 @@ -0,0 +1,33 @@ +{%- set macaddress = item.key -%} +{%- set device = item.value -%} +{%- for selected_net_name, selected_net in idf.net_config.items() if node.interfaces[selected_net.interface].mac_address == macaddress -%} +{%- set selected_inf = node.interfaces[selected_net.interface] -%} +{%- set ifname = device if selected_inf.vlan == 'native' else device + '.' + selected_inf.vlan -%} +{%- set proto = "inet6" if selected_net.network | ipv6 else "inet" -%} +{%- set method = selected_inf.address if selected_inf.address in ["dhcp", "manual"] else "static" -%} + +auto {{ ifname }} +iface {{ ifname }} {{ proto }} {{ method }} +{% if selected_net.gateway is defined %} +up route add default gateway {{ selected_net.gateway | ipaddr('address') }} +{% endif %} +{% if method != "manual" %} +address {{ selected_inf.address | ipaddr('address') }} +{% endif %} +{% if selected_inf.address | ipv6 %} +netmask {{ selected_net.mask }} +{% endif %} +{% if selected_inf.address | ipv4 %} +netmask {{ (selected_net.network + "/" + (selected_net.mask | string)) | ipaddr('netmask') }} +{% endif %} +{% if selected_net.gateway is defined %} +gateway {{ selected_net.gateway | ipaddr('address') }} +{% endif %} +{% if selected_net.routes is defined %} +{% for route in selected_net.routes %} +up route add -net {{ route.network }}/{{ route.mask }} gw {{ route.gateway }} +{% endfor %} +{% endif %} + +{%- endfor -%} + -- cgit 1.2.3-korg