Update Ubuntu 20.04 default network-config by cloud-config
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Invalid
|
Undecided
|
Unassigned |
Bug Description
This is a follow-up on the case https:/
I cannot update default Ubuntu network-config by writing user-data file in cloud-config.
Attached are logs. Below is a snippet from the cloud-config
#cloud-config
write_files:
- path: /etc/cloud/
permissions: '0644'
content: |
network:
config: disabled
- path: /etc/netplan/
permissions: '0644'
content: |
network:
version: 2
ethernets:
eth0:
dhcp4: true
- 192.168.53.3/26
- 1.1.1.1
- 8.8.8.8
runcmd:
- [sudo, netplan, try]
- [sudo, netplan, generate]
- [sudo, netplan, apply]
power_state:
mode: 'reboot'
message: 'reboot triggered by cloud-init'
-----
Result is such that the hardcoded network-config ('optional': True, not waiting for DHCP server) is attached/generated with IP as, for an example - 192.168.53.4, not the IP I really want 192.168.53.3. This leads to couple of problems, one as specified in bug/1924922, that ssh_import_id is not working (for the time is not sync up)
Is there a way to overwrite this default with user-data, and not to go to the config partition and manually change it?
I also tried to modify this network-config, to delete line
optional: true
runcmd: boot/firmware/ network- config,
- [
sudo,
sed,
-i,
'/optional: true/d',
/
]
It did deleted the line, yet again I can see this info (with optional: True)
137 2020-04-01 17:23:50,830 - networking. py[DEBUG] : net: all expected physical devices present
138 2020-04-01 17:23:50,830 - stages.py[DEBUG]: applying net config names for {'version': 2, 'ethernets': {'eth0': {'dhcp4': True, 138 'optional': True}}}
139 2020-04-01 17:23:50,831 - __init__.py[DEBUG]: no interfaces to rename
----
Please assist, how to change the thing, to optional: False, as the way I applied (deleted the line - as can be verified below) , has no impact
cat /boot/firmware/ network- config
# Some additional examples are commented out below
version: 2
ethernets:
eth0:
dhcp4: true
#wifis: