OK I changed up the approach here after some good testing on Azure (attaching 
new nics, detatching original eth0 nic, reattaching nics etc).



systemd does let us pass inverted matches per 
https://www.freedesktop.org/software/systemd/man/systemd.network.html#Name=

Per Daniel's suggestion, we can deliver a static netplan yaml in Azure 
netplan-enabled cloud-images. But, that netplan needs to complement the 
original 50-cloud-init.yaml which will not be updated by cloud-init after first 
boot.



We can then also drop the udev rules and the changes I made to ephemeral_eth.sh 
script as that would be completely unused in netplan environments.
 
This way we don't have to run netplan apply on each udev add event.

The static netplan is as follows:
 /etc/netplan/90-hotplug-azure.yaml
# Automatically generated by /usr/local/sbin/ephemeral_eth.sh to setup
# Azure attached nics after initial instance boot
network:
    version: 2
    ethernets:
        ephemeral:
            dhcp4: true
            match:
                driver: hv_netvsc
                name: '!eth0'
            optional: true
        hotpluggedeth0:
            dhcp4: true
            match:
                driver: hv_netvsc
                name: 'eth0'

-- 
https://code.launchpad.net/~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug/+merge/347212
Your team VMBuilder is requested to review the proposed merge of 
lp:~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug into 
lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm.

_______________________________________________
Mailing list: https://launchpad.net/~vmbuilder
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~vmbuilder
More help   : https://help.launchpad.net/ListHelp

Reply via email to