example42 / puppet-network

Puppet module to manage networking on Suse, Debian and RedHat.
Apache License 2.0
31 stars 165 forks source link

Support EL8 #292

Closed florianfa closed 4 years ago

florianfa commented 5 years ago

Expected Behavior

Network Module should successfully restart network service on RHEL 8 / Centos 8

Actual Behavior

Error: /Stage[main]/Network/Exec[service network restart]: Failed to call refresh: 'service network restart' returned 5 instead of one of [0]

Steps to Reproduce the Problem

Specifications

Please add this info:

  1. Output of facter -p on the failing node (at least the OS related facts)
  2. Version of Puppet and of the module
  3. The relevant Puppet code and eventually Hiera data
FcoCalero commented 5 years ago

Hi,

Im having the same issue and still can't explain why, but if you run a second time, it doens't complain anymore.

Regards

FcoCalero commented 5 years ago

I noticed the following

service network status Redirecting to /bin/systemctl status network.service Unit network.service could not be found.

And it is explained in https://www.golinuxcloud.com/unit-network-service-not-found-rhel-8-linux/

FcoCalero commented 5 years ago

I see two solutions, the easy and the good one.

The easy is yum install network-scripts

That will provide the old stuff needed to make the current version of this module works

The good one Add new code to allow to the module manage interfaces with NetworkManager

njegosrailic commented 5 years ago

I vote for the good one. Seems like everything works we just need to set correct service name for service_restart_exec. Will check and probably put an PR soon.

FcoCalero commented 5 years ago

Already did a PR, waitting feedback

florianfa commented 5 years ago

Hi,

Im having the same issue and still can't explain why, but if you run a second time, it doens't complain anymore.

Regards

Hello FcoCalero,

this is because the restart of the network stack would be only triggered once if the network configuration file changes. On the second run no change happens to the network config file therefore no restart would be triggered.

Regards, Florian

alvagante commented 5 years ago

Looks like NetworkManager is the default network management service in rhel8, but I wonder how many use it on servers. Note also, that the network::service_restart_exec parameter allows customisation of the command to run to restart the service. So with the current module it's actually possible to configure the correct service restart command, whatever is the method used.

alvagante commented 4 years ago

Merged in https://github.com/example42/puppet-network/pull/299