Defined Type: dstserver::entity::caves

Defined in:
manifests/entity/caves.pp

Summary

Configure the cave shard of an instance and manage its systemd service

Overview

Parameters:

  • path (String)

    Location to configure the shards data at

  • ports (Array[Integer, 3, 3]) (defaults to: [11035, 11036, 11037])

    Ports to assign to this shard

  • ensure (Enum[present, absent]) (defaults to: present)

    Install and run or remove the cave shard from the instance

  • worldgenoverride (Optional[Hash])

    Worldgenoverride part for the caves of this instance, see section Worldgenoverride Config in Readme.md

  • mods (Optional[Hash])

    Configuration Hash for mods on this instance, see section Mod Config in Readme.md



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
# File 'manifests/entity/caves.pp', line 16

define dstserver::entity::caves(
  String $path,
  Array[Integer, 3, 3] $ports = [11035, 11036, 11037],
  Enum[present, absent] $ensure = present,
  Optional[Hash] $worldgenoverride,
  Optional[Hash] $mods,
  ) {
  if ($ensure == present) {
    # Caves active for this instance
    file{$path:
      ensure  => directory,
    }
    file{"${path}/server.ini":
      ensure  => [file, present],
      # Will be modified by the server process
      replace => 'no',
      content => epp('dstserver/server.caves.ini', {
        ports => $ports
      })
    }
    if $worldgenoverride {
      dstserver::config::worldgenoverride{"${name}-caves":
        ensure => present,
        path   => $path,
        *      => $worldgenoverride,
      }
    } else {
      dstserver::config::worldgenoverride{"${name}-caves":
        ensure => absent,
        path   => $path,
      }
    }
    dstserver::config::modoverride{"${name}-caves":
      path   => $path,
      mods   => $mods,
      notify => Service["dst-caves@${name}"],
    }
    service{"dst-caves@${name}":
      ensure  => running,
      enable  => true,
      require => File['service-dst-caves']
    }
  } else {
    # Caves disabled for this instance
    file{$path:
      ensure  => absent,
    }
    service{"dst-caves@${name}":
      ensure  => stopped,
      enable  => false,
      require => File['service-dst-caves']
    }
  }
}