brianshumate.nomad

Ansible-Nomad


This role was previously managed by Brian Shumate and is now maintained by @ansible-community/hashicorp-tools.


This Ansible role helps install Nomad with basic setup, file structure, and sample configuration.

It can also set up a small cluster with 3 server nodes, suitable for a development environment using Vagrant and VirtualBox. For more details on setting up with Vagrant, check README_VAGRANT.md.

Requirements

This role works with Arch Linux, Debian, RHEL, or Ubuntu distributions. It is tested with the following software versions:

  • Ansible: 2.7.10
  • Nomad: 0.12.1
  • Arch Linux
  • CentOS: 7
  • Debian: 8
  • RHEL: 7
  • Ubuntu: >= 20.04
  • Unzip for unarchive module

Role Variables

Most variables are defined in defaults/main.yml:

nomad_debug

  • Enable Nomad debug mode
  • Default: no

nomad_skip_ensure_all_hosts

  • Allows running the role even if all instances aren't connected
  • Default: no

nomad_allow_purge_config

  • Permits removal of outdated configuration files
  • Default: no

nomad_version

  • Version of Nomad to install
  • Default: 1.1.1

nomad_architecture_map

  • Usually does not need to be changed
  • Default: Maps ansible architecture to HashiCorp names

nomad_architecture

  • Host system architecture
  • Default: Determined by {{ nomad_architecture_map[ansible_architecture] }}

nomad_pkg

  • Name of the Nomad package file
  • Default: nomad_{{ nomad_version }}_linux_{{ nomad_architecture }}.zip

nomad_zip_url

  • URL to download Nomad
  • Default: https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_linux_{{ nomad_architecture }}.zip

nomad_checksum_file_url

  • URL for Nomad checksum file
  • Default: https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version}}_SHA256SUMS

nomad_bin_dir

  • Path for Nomad binary installation
  • Default: /usr/local/bin

nomad_config_dir

  • Path for Nomad configuration files
  • Default: /etc/nomad.d

nomad_data_dir

  • Path for Nomad data
  • Default: /var/nomad

nomad_lockfile

  • Path for Nomad lockfile
  • Default: /var/lock/subsys/nomad

nomad_run_dir

  • Path for Nomad runtime
  • Default: /var/run/nomad

nomad_manage_user

  • Should the Nomad user be managed?
  • Default: yes

nomad_user

  • OS username for Nomad
  • Default: root

nomad_manage_group

  • Should the Nomad group be managed?
  • Default: no

nomad_group

  • OS group for Nomad
  • Default: bin

nomad_region

  • Default region for Nomad
  • Default: global

nomad_datacenter

  • Datacenter label for Nomad
  • Default: dc1

nomad_log_level

  • Logging level for Nomad
  • Default: INFO

nomad_syslog_enable

  • Log to syslog?
  • Default: true

nomad_iface

  • Network interface used by Nomad
  • Default: {{ ansible_default_ipv4.interface }}

nomad_node_name

  • Node name for Nomad
  • Default: {{ inventory_hostname_short }}

nomad_node_role

  • Role of the Nomad node
  • Options: client, server, both
  • Default: client

Other Variables

There are many other variables available for advanced configurations, such as managing reserved resources, setting garbage collection, enabling telemetry, and configuring Vault settings. Each variable typically comes with a default value and an explanation.

For example:

  • nomad_gc_interval: Client garbage collection interval. Default: 1m
  • nomad_ui: Enable UI-based label customization. Default: false

Dependencies

Ansible needs GNU tar, and this role uses the unarchive module, so make sure your system has gtar/unzip installed. The Jinja2 templates also require the netaddr Python library for IP address filtering.

Example Playbook

To perform a basic installation of Nomad, you can use the provided site.yml playbook:

ansible-playbook -i <hosts> site.yml

You can also pass additional variables using the --extra-vars flag:

ansible-playbook -i hosts site.yml --extra-vars "nomad_datacenter=maui"

Vagrant and VirtualBox

For quick setups using Vagrant under VirtualBox for testing, refer to examples/README_VAGRANT.md.

License

Licensed under BSD.

Author Information

Brian Shumate

Contributors

Thanks to everyone listed in CONTRIBUTORS.md for their contributions. Contributions are also welcome as long as they comply with the terms in CONTRIBUTING.md.

Installa
ansible-galaxy install brianshumate.nomad
Licenza
bsd-2-clause
Download
18.3k
Proprietario
Art ⁂ Data ⁂ Boards ⁂ Water