Puppet Class: perfsonar::config

Defined in:
manifests/config.pp

Summary

Manage perfSONAR configs

Overview



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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'manifests/config.pp', line 3

class perfsonar::config {
  assert_private()

  if $perfsonar::web_admin_password and versioncmp($puppetversion, '8.0') >= 0 { # lint:ignore:variable_scope
    package { 'webrick':
      ensure   => 'installed',
      provider => 'puppet_gem',
    }
  }

  if $perfsonar::web_admin_password and $facts['webrick_installed'] {
    httpauth { 'psadmin':
      ensure    => 'present',
      username  => $perfsonar::web_admin_username,
      password  => $perfsonar::web_admin_password,
      file      => '/etc/perfsonar/toolkit/psadmin.htpasswd',
      mechanism => 'basic',
      owner     => 'root',
      group     => $perfsonar::apache_group,
      mode      => '0640',
    }
    if versioncmp($puppetversion, '8.0') >= 0 { # lint:ignore:variable_scope
      Httpauth['psadmin'] -> Package['webrick']
    }
  }

  if $perfsonar::remove_root_prompt {
    file { '/etc/profile.d/add_psadmin_pssudo.sh':
      ensure => 'absent',
    }
  }

  if $perfsonar::manage_apache {
    if $facts['os']['family'] == 'Debian' {
      $ssl_change_prefix = 'IfModule/VirtualHost'
    } else {
      $ssl_change_prefix = 'VirtualHost'
    }
    if $perfsonar::ssl_chain_file {
      $ssl_chain_file_change = "set ${ssl_change_prefix}/*[self::directive = 'SSLCertificateChainFile']/arg ${perfsonar::ssl_chain_file}"
    } else {
      $ssl_chain_file_change = "rm ${ssl_change_prefix}/*[self::directive = 'SSLCertificateChainFile']"
    }
    $ssl_changes = [
      "set ${ssl_change_prefix}/*[self::directive = 'SSLCertificateFile']/arg ${perfsonar::ssl_cert}",
      "set ${ssl_change_prefix}/*[self::directive = 'SSLCertificateKeyFile']/arg ${perfsonar::ssl_key}",
      $ssl_chain_file_change,
    ]

    augeas { 'apache-perfsonar-ssl':
      incl    => $perfsonar::apache_ssl_conf,
      lens    => 'Httpd.lns',
      changes => $ssl_changes,
      notify  => Service['httpd'],
    }

    service { 'httpd':
      ensure => 'running',
      enable => true,
      name   => $perfsonar::apache_service,
    }
  }

  if $perfsonar::bundle == 'perfsonar-toolkit' and $perfsonar::primary_interface {
    file_line { 'web_admin-primary_interface':
      path  => '/etc/perfsonar/toolkit/web/web_admin.conf',
      line  => "primary_interface ${perfsonar::primary_interface}",
      match => '^primary_interface',
    }
  }
}