Puppet Class: marathon

Inherited by:
marathon::install
marathon::haproxy_config
Defined in:
manifests/init.pp

Overview

Class: marathon

This module installs, configures and manages marathon

Parameters: none

Actions:

Requires: see Modulefile

Sample Usage:

Parameters:

  • installation_ensure (Any) (defaults to: 'present')
  • url (Any) (defaults to: 'https://downloads.mesosphere.io/marathon/v0.8.2-RC1/marathon-0.8.2-RC1.tgz')
  • digest_string (Any) (defaults to: '45a481f4703e1455f8aafa037705c9033200f2dc7f9d5e6414acde533d6cb935')
  • digest_type (Any) (defaults to: 'sha256')
  • tmp_dir (Any) (defaults to: '/tmp')
  • install_dir (Any) (defaults to: '/opt/marathon')
  • user (Any) (defaults to: 'root')
  • create_symlinks (Any) (defaults to: true)
  • haproxy_discovery (Any) (defaults to: false)
  • manage_service (Any) (defaults to: true)
  • service_name (Any) (defaults to: 'marathon')
  • options (Any) (defaults to: hiera('classes::marathon::options', { }))
  • manage_firewall (Any) (defaults to: false)
  • manage_user (Any) (defaults to: true)
  • checksum (Any) (defaults to: true)
  • consul_discovery (Any) (defaults to: false)
  • consul_options (Any) (defaults to: hiera('classes::consul::options',{ }))
  • install_consul_template (Any) (defaults to: false)
  • consul_template_options (Any) (defaults to: hiera('classes::consul_template::options', { }))
  • consul_template_watches (Any) (defaults to: hiera('classes::consul_template::watches', { }))
  • install_docker (Any) (defaults to: true)
  • docker_socket_bind (Any) (defaults to: '/var/run/docker.sock')
  • docker_dns (Any) (defaults to: '8.8.8.8')
  • install_registrator (Any) (defaults to: true)
  • registrator_resync (Any) (defaults to: 30)
  • registrator_args (Any) (defaults to: '')


13
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'manifests/init.pp', line 13

class marathon(
# Install or uninstall (present|absent)
  $installation_ensure      = 'present',
# Marathon binary url
  $url                      = 'https://downloads.mesosphere.io/marathon/v0.8.2-RC1/marathon-0.8.2-RC1.tgz',
# Marathon binary digest string
  $digest_string            = '45a481f4703e1455f8aafa037705c9033200f2dc7f9d5e6414acde533d6cb935',
# The digest type
  $digest_type              = 'sha256',
# Temporary directory to download the files to
  $tmp_dir                  = '/tmp',
# Marathon Installation directory
  $install_dir              = '/opt/marathon',
# The username that marathon will submit tasks as
  $user                     = 'root',
# Create symlinks for the marathon binaries for easier access
  $create_symlinks          = true,
#  Whether to use haproxy for load balancing between services
  $haproxy_discovery        = false,
# Create and manage the marathon service
  $manage_service           = true,
# The marathon service's name
  $service_name             = 'marathon',
# The marathon options
  $options                  = hiera('classes::marathon::options', { }),
# Manage the firewall rules
  $manage_firewall          = false,
# Manage the user that the tasks will be submitted as
  $manage_user              = true,
# Whether or not the integrity of the archive should be verified
  $checksum                 = true,
#  Whether or not to use consul (http://consul.io) for service discovery
  $consul_discovery         = false,
#  Consul configuration
  $consul_options           = hiera('classes::consul::options',{ }),
# Whether to install consul-template or not
  $install_consul_template  = false,
#  consul-template options
  $consul_template_options  = hiera('classes::consul_template::options', { }),
#  consul template watches
  $consul_template_watches  = hiera('classes::consul_template::watches', { }),
# Whether to install docker or not
  $install_docker           = true,
# Docker socket path
  $docker_socket_bind       = '/var/run/docker.sock',
# Docker DNS
  $docker_dns               = '8.8.8.8',
# Whether to install registraator or not
  $install_registrator      = true,
#  How often should registrator query docker for services (See: https://github.com/gliderlabs/registrator)
  $registrator_resync       = 30,
#  Additional registrator flags
  $registrator_args         = ''
) {

  validate_bool(
    $create_symlinks,
    $manage_service,
    $manage_firewall,
    $manage_user,
    $haproxy_discovery,
    $consul_discovery,
    $checksum,
    $install_consul_template,
    $install_docker,
    $install_registrator
  )
  validate_absolute_path(
    $tmp_dir,
    $install_dir,
    $docker_socket_bind
  )
  validate_string(
    $url,
    $digest_string,
    $user,
    $docker_dns,
    $registrator_args
  )
  validate_integer($registrator_resync)
  validate_re($installation_ensure, '^(present|absent)$',"${installation_ensure} is not supported for installation_ensure. Allowed values are 'present' and 'absent'.")
  validate_hash(
    $options,
    $consul_options,
    $consul_template_options,
    $consul_template_watches
  )

  if $options != undef and $options['HTTP_ADDRESS'] != undef {
    if  !has_interface_with('ipaddress', $options['HTTP_ADDRESS']) {
      fail('The specified IP does not belong to this host.')
    }
  }

  anchor{ 'marathon::install::start': } ->
  class { 'marathon::install': } ->
  anchor { 'marathon::install::end': }

  if $consul_discovery == true {
    anchor{ 'marathon::haproxy_config::start': } ->
    class { 'marathon::haproxy_config': }
    anchor{ 'marathon::haproxy_config::end': }
  }

}