Defined Type: zookeeperd::node

Defined in:
manifests/node.pp

Summary

A short summary of the purpose of this defined type.

Overview

zookeeperd::node

A node definition to be added as server line in zoo.cfg file. One may define the nodes of an zookeeper ensamble by instanciating this resource. The module itself is implementing a factory to create nodes to all keys added to zookeeperd::nodes hash. This resource is also used with autoconfiguration, which exports this resource and collect all exported nodes of the same ensamble.

Examples:

zookeeperd::node { 'first node of this cluster':
  nodeid   => 1,
  nodename => 'first.zk.example.org',
}
zookeeperd::node { 'second node of this cluster':
  nodeid   => 2,
  nodename => 'second.zk.example.org',
}

Parameters:

  • nodeid (Integer)

    node id (myid) of the zookeeper node to be added to this configuration

  • nodename (String)

    fqdn or IP address of the node to be added

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

    ensure meta-parameter to add or remove this node

  • cfgtgt (String) (defaults to: $zookeeperd::cfg_path)

    path to the configuration file to which this server should be added

  • ensamble (Optional[String]) (defaults to: undef)

    name of the ensamble this node belongs to (used with autoconfig)

  • leaderport (Integer) (defaults to: 2888)

    leader port parameter of the server

  • electionport (Integer) (defaults to: 3888)

    port used for leader election



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'manifests/node.pp', line 29

define zookeeperd::node(
  Integer                   $nodeid,
  String                    $nodename,
  Enum['present', 'absent'] $ensure = 'present',
  String                    $cfgtgt = $zookeeperd::cfg_path,
  Optional[String]          $ensamble = undef,
  Integer                   $leaderport = 2888,
  Integer                   $electionport = 3888,
) {
  if !defined(Concat::Fragment["zoo.cfg node entry for ${nodename}"]) and $ensure == 'present' {
    concat::fragment { "zoo.cfg node entry for ${nodename}":
    target  => $cfgtgt,
    content => "server.${nodeid}=${nodename}:${leaderport}:${electionport}",
    order   => 10,
    }
  }
}