summaryrefslogtreecommitdiff
path: root/manifests/interface.pp
blob: 10373d1324360215c8dd2880733328d0076d7405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
define wpa_supplicant::interface (
  String $interface = $name,
  Array[Hash] $networks = [],
) {
  service { "wpa_supplicant@${interface}.service":
    ensure => running,
    enable => true,
  }

  file { "/etc/wpa_supplicant/wpa_supplicant-${interface}.conf":
    ensure     => file,
    content    => epp('wpa_supplicant/wpa_supplicant.conf.epp', {
      networks => $networks
    }),
  } ~> exec { "Reload wpa_supplicant for ${interface}":
    command     => [ 'wpa_cli', 'reconfigure', '-i', $interface, ],
    path        => [ '/bin', '/usr/bin', ],
    refreshonly => true,
  }
}