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 (Boolean) (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)


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
# 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,
  Boolean $syslog_ng = $::anysync::syslog_ng,
  Boolean $create_storage_path_dir,
) {
  $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 $syslog_ng {
    syslog_ng::cfg { "any-sync-node": template => "t_short" }
  }
  systemd::unit_file { "any-sync-node.service":
    content => template("${module_name}/service.erb"),
    enable => true,
    active => true,
  }
}