voxpupuli / puppet-network

Types and providers to manage network interfaces
https://forge.puppet.com/puppet/network
Apache License 2.0
66 stars 108 forks source link

forcing network service restart upon a change #221

Open gerases opened 7 years ago

gerases commented 7 years ago

Hi,

Upon configuring an interface, I though the network service would restart, but it doesn't. Can I do something to make that happen automatically? This is how I configure an interface:

network_config { $corosync_iface:
    ensure    => 'present',
    family    => 'inet',
    ipaddress => $corosync_ip,
    method    => 'static',
    onboot    => true,
}

Thanks

rski commented 7 years ago

Hi gerases,

this is a known issue https://github.com/voxpupuli/puppet-network/issues/132. Forcing an if down/up on the interfaces (with exec?) would make them use the updated configuration.

gerases commented 7 years ago

Cool. I was thinking about doing an exec but wasn't sure if it was best practice. Thank you much.

rski commented 7 years ago

Well, I don't know if that is the right solution either, but that is what I ended up doing when using puppet-network myself. Hope it helps.

eliaoggian commented 6 years ago

I am wondering if restarting the network service at every puppet run is a good idea. What I mean is: in a production environment, could this cause some connection issues?

I am using the network module as it follows:

class profile::network::interfaces($interfaces = hiera('interfaces',false)) {
  if ($interfaces != false) {

    include '::network'
    create_resources(network_config, $interfaces)

  }
}

And in hiera:

interfaces:
  ens160:0:
    name: 'ens160:0'
    ensure: 'present'
    provider: 'interfaces'
    onboot: 'true'
    ipaddress: 'xxx.xxx.xxx.xxx'
    netmask: 'xxx.xxx.xxx.xxx'
    method: 'static'
    family: 'inet'
    hotplug: 'false'

How could I implement something that restarts the network service only when changes are made?