Configure BM interface only on specific nodes

Some nodes like UCP master doesn't have ironic baremetal interface.
Do not configure it when network is not connected.

Related-Prod: PRODX-4769
Change-Id: Ia7ec5bca660a64e82e940dc39a0c6536b698bdba
diff --git a/de/heat-templates/scripts/instance_boot.sh b/de/heat-templates/scripts/instance_boot.sh
index 21e23be..98eadf1 100644
--- a/de/heat-templates/scripts/instance_boot.sh
+++ b/de/heat-templates/scripts/instance_boot.sh
@@ -350,6 +350,8 @@
 Name=veth-br
 EOF
 
+if [[ -n ${IRONIC_BAREMETAL_INTERFACE} ]]; then
+
 cat << EOF > /etc/systemd/network/11-veth-bm.netdev
 [NetDev]
 Name=veth-bm
@@ -365,20 +367,22 @@
 [Peer]
 Name=veth-vbmc-br
 EOF
+fi
 
     sed -i 's/.*ethernets:.*/&\n        veth-phy: {}/' ${cloud_netplan_cfg}
     sed -i 's/.*ethernets:.*/&\n        veth-br: {}/' ${cloud_netplan_cfg}
+if [[ -n ${IRONIC_BAREMETAL_INTERFACE} ]]; then
     sed -i 's/.*ethernets:.*/&\n        veth-bm: {}/' ${cloud_netplan_cfg}
     sed -i 's/.*ethernets:.*/&\n        veth-bm-br: {}/' ${cloud_netplan_cfg}
     sed -i 's/.*ethernets:.*/&\n        veth-vbmc: {}/' ${cloud_netplan_cfg}
     sed -i 's/.*ethernets:.*/&\n        veth-vbmc-br: {}/' ${cloud_netplan_cfg}
 
-    public_address_match_ip_line=$(grep -nm1 "${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK}" ${cloud_netplan_cfg} | cut -d: -f1)
-    sed -i "$((${public_address_match_ip_line}-1)),$((${public_address_match_ip_line}))d" ${cloud_netplan_cfg}
-
     ironic_baremetal_address_match_ip_line=$(grep -nm1 "${IRONIC_BAREMETAL_INTERFACE_IP}/${IRONIC_BAREMETAL_NETWORK_NETMASK}" ${cloud_netplan_cfg} | cut -d: -f1)
     sed -i "$((${ironic_baremetal_address_match_ip_line}-1)),$((${ironic_baremetal_address_match_ip_line}))d" ${cloud_netplan_cfg}
+fi
 
+    public_address_match_ip_line=$(grep -nm1 "${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK}" ${cloud_netplan_cfg} | cut -d: -f1)
+    sed -i "$((${public_address_match_ip_line}-1)),$((${public_address_match_ip_line}))d" ${cloud_netplan_cfg}
 
 cat << EOF >> ${cloud_netplan_cfg}
     bridges:
@@ -389,6 +393,10 @@
             - veth-br
             addresses:
             - ${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK}
+EOF
+
+if [[ -n ${IRONIC_BAREMETAL_INTERFACE} ]]; then
+cat << EOF >> ${cloud_netplan_cfg}
         br-baremetal:
             dhcp4: false
             interfaces:
@@ -399,6 +407,7 @@
             - ${IRONIC_BAREMETAL_INTERFACE_IP}/${IRONIC_BAREMETAL_NETWORK_NETMASK}
 
 EOF
+fi
     netplan --debug apply
 
     # NOTE(vsaienko): give some time to apply changes