Puppet Class: anysync::node::config

Defined in:
manifests/node/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

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

    enable or disable syslog-ng configuration for logging

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


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
74
75
76
77
78
79
80
# File 'manifests/node/config.pp', line 14

class anysync::node::config (
  Hash $cfg,
  Hash $accounts,
  String $user,
  String $group,
  Variant[Integer,Boolean] $uid,
  Variant[Integer,Boolean] $gid,
  String $daemon_name,
  Hash $syslog_ng = $::anysync::_syslog_ng,
  Boolean $create_storage_path_dir,
  Variant[Integer,Boolean] $limit_nofile = $::anysync::limit_nofile,
) {
  $basedir = dirname($cfg['networkStorePath'])
  user { $user:
    ensure => present,
    shell => '/sbin/nologin',
    managehome => false,
    uid => $uid,
  }
  -> group { $group:
    ensure => present,
    gid => $gid,
  }
  -> file {
    "/etc/any-sync-node/":
      ensure => directory,
    ;
    "/etc/any-sync-node/config.yml":
      content => template("${module_name}/yaml.erb"),
      notify => Service["any-sync-node"],
    ;
    [
      $basedir,
      $cfg['networkStorePath'],
    ]:
      ensure => directory,
      owner => $user,
      group => $group,
    ;
  }
  if $create_storage_path_dir {
    file {
      $cfg['storage']['path']:
        ensure => directory,
        owner => $user,
        group => $group,
      ;
    }
    if has_key($cfg['storage'],'anyStorePath') {
      file {
        $cfg['storage']['anyStorePath']:
          ensure => directory,
          owner => $user,
          group => $group,
        ;
      }
    }
  }
  if $syslog_ng['ensure'] {
    syslog_ng::cfg { "any-sync-node": * => $syslog_ng }
  }
  systemd::unit_file { "any-sync-node.service":
    content => template("${module_name}/service.erb"),
    enable => true,
    active => true,
  }
}