aboutsummaryrefslogtreecommitdiff
path: root/manifests/install.pp
blob: c61a1945e26ec223145e3aeccc200671d7073838 (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
47
48
49
50
51
52
53
54
55
#
# @api private
#
# @summary This class handles the configuration file. Avoid modifying private classes.
#
class ferm::install {
  # this is a private class
  assert_private("You're not supposed to do that!")

  case $ferm::install_method {
    'package': {
      package { 'ferm':
        ensure => 'latest',
      }
    }
    'vcsrepo': {
      $_source_path = '/opt/ferm'
      ensure_packages (['git', 'iptables', 'perl', 'make'], { ensure => present })

      package { 'ferm':
        ensure => absent,
      }
      -> vcsrepo { $_source_path :
        ensure   => present,
        provider => git,
        source   => $ferm::vcsrepo,
        revision => $ferm::vcstag,
      }
      -> exec { 'make install':
        cwd     => $_source_path,
        path    => '/usr/sbin:/usr/bin:/sbin:/bin',
        creates => '/usr/sbin/ferm',
      }
      -> file { '/etc/ferm':
        ensure => directory,
        owner  => 0,
        group  => 0,
        mode   => '0700',
      }
    }
    default: {
      fail("unexpected install_method ${ferm::install_method}")
    }
  }

  if $ferm::manage_initfile {
    if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '6') <= 0 {
      file { '/etc/init.d/ferm':
        ensure => 'file',
        mode   => '0755',
        source => "puppet:///modules/${module_name}/ferm",
      }
    }
  }
}