Nmcli is not working in Kickstart script

centos7kickstartnetworkmanagerrhel7

I have the following commands in a Kickstart post-install script:

firewall-offline-cmd --new-zone=management
firewall-offline-cmd --zone=management --add-service=ssh --add-service=snmp
firewall-offline-cmd --zone=management --change-interface=eth1
nmcli device modify eth1 connection.zone management

From my reading it seems that firewalld can't make these changes when NetworkManager is in the picture, so I added in the nmcli command to change the zone. But it is not taking effect. After the install is complete and the server reboots, the interface remains in the default zone. After that I can then run the nmcli command and it will take effect.

I can't find anything online about this problem, except maybe this article, but it's behind a paywall.

Best Answer

I've run into this issue as well. I got around it with this hack:

echo 'ZONE=management' >> /etc/sysconfig/network-scripts/ifcfg-eth1

I'd prefer something more elegant but have settled on that for the time being.