Open rhmk opened 2 years ago
Everything works as designed. The follwowing task before a reboot is fixing the issue:
- name: ensure network configuration is persistent
include_role:
name: rhel-system-roles.network
vars:
network_provider: nm
network_connections:
- name: "{{ ansible_default_ipv4.alias }}"
mac: "{{ ansible_default_ipv4.macaddress }}"
interface_name: "{{ ansible_default_ipv4.interface }}"
type: ethernet
ip:
dhcp4: true
dhcp4_send_hostname: true
It will create a file in /etc/sysconfig/network-scripts to make the connection persistent. For production with multiple interfaces, it would be a good practice to run the network role anyway after VM creation
So a possible probe for a warning in the playbook network section could be no /etc/sysconfig/network-scripts/ifcfg-* files or run a " nmcli c s " command and check if a ifcfg-$1 for existing NW config do exist. If not throw a warning or error
It's not affecting only to the GCP VMs, I was able to reproduce the issue in a generic VM and I had the same behavior of the VM.
I saw the problem with GCP first., but it is likely to occur on any cloud or virtualization environment. The issue is based on the fact that NetworkManager in client mode (default) tries to discover an IP address on any available interface. This is a good behavior for laptops or cloud images, where you do not know, which interfaces exist or which will be connected at boot time. But this is an unwanted behavior for servers where you have a well-defined environment. The package NetworkManager-config-server disables this functionality. It will be installed as a member of the server package group during the sap-preconfigure script. For servers, you should use the network system role prior to running the sap prep playbooks to get a proper and well-defined network setup, or if it is just a demo system you can use the above configuration to persist the DHCP connection on the found interface.
I don't think this has to be fixed in the SAP preconfigure roles because it is a task that is typically performed as part of the initial network configuration. The network system role can be used for exactly this purpose. Nonetheless, the behavior as such should be well documented.
the default image in GCP has not installed the package NetworkManager-config-server.
This adds a NetworkManager configuration file to make it behave more like the old "network" service. In particular, it stops NetworkManager from automatically running DHCP on unconfigured ethernet devices, and allows connections with static IP addresses to be brought up even on ethernet devices with no carrier. This package is intended to be installed by default for server deployments.
Hence the role installs it automatically, with the consequence that dhcp is no longer started on the network interfaces in GCP after reboot and the machine is disconnected from the network.
One easy option is to print a warning if that happens, the other option is to "define" the existing network config if it is unconfigured