aboutsummaryrefslogtreecommitdiff
path: root/manifests/vserver/interface.pp
blob: 3d14d46ed99dce72035a696435c78344f37657db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Changing stuff with this define won't do much good, since it relies on
# restarting the vservers to do the work, which won't clean up orphaned
# interfaces
define virtual::vserver::interface($prefix = 24, $dev = '') {

  file {
    "/etc/vservers/local-interfaces/${name}":
      ensure => directory,
      mode => 0755, owner => root, group => root;
    "/etc/vservers/local-interfaces/${name}/ip":
      content => "${name}\n",
      mode => 0644, owner => root, group => root;
    "/etc/vservers/local-interfaces/${name}/prefix":
      content => "${prefix}\n",
      mode => 0644, owner => root, group => root;
  }

  case $dev {
    '': {
      file { 
        "/etc/vservers/local-interfaces/${name}/nodev":
          ensure => present,
          mode => 0644, owner => root, group => root;
        "/etc/vservers/local-interfaces/${name}/dev":
          ensure => absent;
      }
    }
    default: {
      config_file { "/etc/vservers/local-interfaces/${name}/dev": content => $dev, }
      file { "/etc/vservers/local-interfaces/${name}/nodev": ensure => absent, }
    }
  }
}