Skip to content

Latest commit

 

History

History
336 lines (218 loc) · 7.06 KB

REFERENCE.md

File metadata and controls

336 lines (218 loc) · 7.06 KB

Reference

Table of Contents

Classes

Public Classes

  • nomad: Installs, configures, and manages nomad

Private Classes

  • nomad::config: This class is called from nomad::init to install the config file.
  • nomad::install: This class is called from nomad::init to install the config file.
  • nomad::reload_service: This class is meant to be called from certain configuration changes that support reload.
  • nomad::run_service: This class is meant to be called from nomad It ensure the service is running

Classes

nomad

Installs, configures, and manages nomad

Examples

To set up a single nomad server, with several agents attached, on the server.
class { 'nomad':
  config_hash => {
    'region'     => 'us-west',
    'datacenter' => 'ptk',
    'log_level'  => 'INFO',
    'bind_addr'  => '0.0.0.0',
    'data_dir'   => '/opt/nomad',
    'server'     => {
      'enabled'          => true,
      'bootstrap_expect' => 3,
    }
  }
}
On the agent(s)
class { 'nomad':
  config_hash => {
    'region'     => 'us-west',
    'datacenter' => 'ptk',
    'log_level'  => 'INFO',
    'bind_addr'  => '0.0.0.0',
    'data_dir'   => '/opt/nomad',
    'client'     => {
      'enabled' => true,
      'servers' => [
        "nomad01.your-org.pvt:4647",
        "nomad02.your-org.pvt:4647",
        "nomad03.your-org.pvt:4647"
      ]
    }
  },
}
Install from zip file for a CPU architecture HashiCorp does not provide native packages for.
class { 'nomad':
  arch                => 'armv7l',
  install_method      => 'url',
  manage_service_file => true,
  version             => '1.0.3', # check latest version at https://github.com/hashicorp/nomad/blob/master/CHANGELOG.md
  config_hash         => {
    'region'     => 'us-west',
    'datacenter' => 'ptk',
    'log_level'  => 'INFO',
    'bind_addr'  => '0.0.0.0',
    'data_dir'   => '/opt/nomad',
    'client'     => {
      'enabled' => true,
      'servers' => [
        "nomad01.your-org.pvt:4647",
        "nomad02.your-org.pvt:4647",
        "nomad03.your-org.pvt:4647"
      ]
    }
  },
}
Disable install and service components
class { 'nomad':
  install_method => 'none',
  manage_service => false,
  config_hash    => {
    region     => 'us-west',
    datacenter => 'ptk',
    log_level  => 'INFO',
    bind_addr  => '0.0.0.0',
    data_dir   => '/opt/nomad',
    'client'     => {
      'enabled' => true,
      'servers' => [
        "nomad01.your-org.pvt:4647",
        "nomad02.your-org.pvt:4647",
        "nomad03.your-org.pvt:4647"
      ]
    }
  },
}

Parameters

The following parameters are available in the nomad class:

arch

Data type: String[1]

cpu architecture

purge_config_dir

Data type: Boolean

Purge config files no longer generated by Puppet

Default value: true

join_wan

Data type: Optional[String[1]]

join nomad cluster over the WAN

Default value: undef

bin_dir

Data type: Stdlib::Absolutepath

location of the nomad binary

Default value: '/usr/bin'

version

Data type: String[1]

Specify version of nomad binary to download.

Default value: 'installed'

install_method

Data type: Enum['none', 'package', 'url']

install via system package, download and extract from a url.

Default value: 'package'

os

Data type: String[1]

operation system to install for

Default value: downcase($facts['kernel'])

download_url

Data type: Optional[String[1]]

download url to download from

Default value: undef

download_url_base

Data type: String[1]

download hostname to down from

Default value: 'https://releases.hashicorp.com/nomad/'

download_extension

Data type: String[1]

archive type to download

Default value: 'zip'

package_name

Data type: String[1]

Only valid when the install_method == package.

Default value: 'nomad'

config_dir

Data type: Stdlib::Absolutepath

location of the nomad configuration

Default value: '/etc/nomad.d'

extra_options

Data type: String

Extra arguments to be passed to the nomad agent

Default value: ''

config_hash

Data type: Hash

Use this to populate the JSON config file for nomad.

Default value: {}

config_defaults

Data type: Hash

default set of config settings

Default value: {}

config_mode

Data type: Stdlib::Filemode

Use this to set the JSON config file mode for nomad.

Default value: '0660'

manage_repo

Data type: Boolean

Configure the upstream HashiCorp repository. Only relevant when $nomad::install_method = 'package'.

Default value: true

manage_service

Data type: Boolean

manage the nomad service

Default value: true

manage_service_file

Data type: Boolean

create and manage the systemd service file

Default value: false

pretty_config

Data type: Boolean

Generates a human readable JSON config file.

Default value: false

service_enable

Data type: Boolean

enable the nomad service

Default value: true

service_ensure

Data type: Stdlib::Ensure::Service

ensure the state of the nomad service

Default value: 'running'

restart_on_change

Data type: Boolean

Determines whether to restart nomad agent on $config_hash changes. This will not affect reloads when service, check or watch configs change.

Default value: true

env_vars

Data type: Hash[String[1], String]

Array of optional environment variables that should be passed to nomad

Default value: {}