Comment 13 for bug 1863873

Revision history for this message
Thomas Wien (thwien) wrote :

Thanks a lot for your explanations and workaround examples.

I expanded our ansible update playbooks to check if /etc/netplan/10-lxc.yaml is installed, then to remove that file, runs "netplan apply" and then remove the package "netplan.io". It seems to work in our environment, without loosing the network configuration while updating and also after reboot.

Here is the ansible section we tested. Maybe it is helpful to anyone else. This script comes with no warranty and should be tested in your environment thoroughly.

- name: Is Netplan configuring LXC?
  stat:
    path: /etc/netplan/10-lxc.yaml
  register: netplan
- name: Remove networkd/netplan configuration
  file:
    path: /etc/netplan/10-lxc.yaml
    state: absent
  when: "netplan.stat.exists == true and ansible_virtualization_type == 'lxc'"
- name: Reload networkd/netplan
  command: netplan apply
  when: "netplan.stat.exists == true and ansible_virtualization_type == 'lxc'"
- name: Remove netplan.io
  apt:
    name: netplan.io
    state: absent
  when: "netplan.stat.exists == true and ansible_virtualization_type == 'lxc'"