aboutsummaryrefslogtreecommitdiff
path: root/manifests/vserver/interface.pp
blob: 70548485e6cc2976bb58bba3d9968ca7dca39dd1 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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,
      }
    }
  }
}