Puppet Class: anysync::filenode::config

Defined in:
manifests/filenode/config.pp

Overview

Parameters:

  • cfg (Hash)

    Defines config for daemon

  • accounts (Hash)

    Defines “account” settings for all nodes (see “any_sync_accounts” in README.md)

  • user (String)

    Defines user for daemon files and process

  • group (String)

    Defines group for daemon files and process

  • daemon_name (String)

    Defines daemon name

  • aws_credentials (Hash)

    Defines credentials for access to s3

  • syslog_ng (Hash) (defaults to: $::anysync::_syslog_ng)

    enable or disable syslog-ng configuration for logging

  • limit_nofile (Variant[Integer,Boolean]) (defaults to: $::anysync::limit_nofile)


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
74
75
76
# File 'manifests/filenode/config.pp', line 16

class anysync::filenode::config (
  Hash $cfg,
  Hash $accounts,
  String $user,
  String $group,
  String $daemon_name,
  Hash $aws_credentials,
  Hash $syslog_ng = $::anysync::_syslog_ng,
  Variant[Integer,Boolean] $limit_nofile = $::anysync::limit_nofile,
) {
  $basedir = dirname($cfg['networkStorePath'])
  user { $user:
    ensure => present,
    shell => '/sbin/nologin',
    managehome => true,
  }
  -> group { $group:
    ensure => present,
  }
  -> file {
    "/etc/any-sync-filenode/":
      ensure => directory,
    ;
    "/etc/any-sync-filenode/config.yml":
      content => template("${module_name}/yaml.erb"),
      notify => Service["any-sync-filenode"],
    ;
    [
      $basedir,
      $cfg['networkStorePath'],
      "/home/$user/.aws/",
    ]:
      ensure => directory,
      owner => $user,
      group => $group,
    ;
  }

  $aws_credentials.each |$section, $settings| {
    $settings.each |$setting, $value| {
      ini_setting { "/home/$user/.aws/credentials_${section}-${setting}":
        ensure  => $value == undef ? { true => 'absent', default => 'present' },
        section => $section,
        setting => $setting,
        value   => $value,
        path    => "/home/$user/.aws/credentials",
        notify  => Service["any-sync-filenode"],
        require => File["/home/$user/.aws/"],
      }
    }
  }

  if $syslog_ng['ensure'] {
    syslog_ng::cfg { "any-sync-filenode": * => $syslog_ng }
  }
  systemd::unit_file { "any-sync-filenode.service":
    content => template("${module_name}/service.erb"),
    enable => true,
    active => true,
  }
}