mullholland.nomad

Ansible role nomad

description

GitHub Downloads Version
github downloads Version

Example Playbook

This example is taken from molecule/default/converge.yml and is tested on each push, pull request and release.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true
  # vars:
  #   example_var: "value"
  roles:
    - role: "mullholland.nomad"

The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: true

  tasks:
    - name: Debian/Ubuntu | Install support packages for testing
      package:
        name:
          - "iproute2"  # for ansible_default_ipv4.address
          - "cron"  # for backup cron
          - "findutils"  # for backup cron
        state: latest
      when: ansible_os_family == "Debian"

    - name: RedHat/CentOS | Install support packages for testing
      package:
        name:
          - "iproute"  # for ansible_default_ipv4.address
          - "cronie"  # for backup cron
          - "findutils"  # for backup cron
        state: latest
      when: ansible_os_family == "RedHat" or ansible_os_family == "Rocky"

  roles:
    - role: mullholland.repository_hashicorp

Role Variables

The default values for the variables are set in defaults/main.yml:

---
# Is this server a nomad server?
# agents need this as `false`
nomad_server: true

# Packages
nomad_packages:
  - nomad
  # - nomad-enterprise

# set nomad license variable
# nomad_license: "12345679987654321"

# bin to this address
nomad_bind_address: "0.0.0.0"

# System user and group (from package)
nomad_user: "nomad"
nomad_group: "nomad"

# # Paths
nomad_config_path: "/etc/nomad.d"
nomad_data_path: "/opt/nomad/data"
nomad_log_path: "/var/log/nomad"
nomad_run_path: "/var/run/nomad"

# Create nomad configuration
# Sections are only for your personal structure
# they have no effect on the configuration
nomad_config_sections:
  - name: base
    config: |
      bind_addr = "{{ nomad_bind_address }}"
      data_dir  = "{{ nomad_data_path }}"
      name      = "{{ inventory_hostname }}"
  - name: logging
    config: |
      log_level            = "INFO"
      log_json             = false
      log_file             = "{{ nomad_log_path }}/nomad.log"
      log_rotate_duration  = "24h" # rotate after 24h
      log_rotate_max_files = "7"   # keep 1 week worth of logs
  - name: server
    config: |
      server {
        enabled          = true
        bootstrap_expect = 1  # Self-elect, should be 3 or 5 for production
      }
  - name: agent
    config: |
      client {
        enabled = true
        servers = [ "{{ inventory_hostname }}:4647" ]
      }
      # Disable the dangling container cleanup to avoid interaction with other clients
      plugin "docker" {
        config {
          gc {
            dangling_containers {
              enabled = false
            }
          }
        }
      }
  - name: telementry
    config: |
      telemetry {
        publish_allocation_metrics = true
        publish_node_metrics       = true
        prometheus_metrics         = true
      }

Requirements

State of used roles

The following roles are used to prepare a system. You can prepare your system in another way.

Requirement GitHub GitLab
mullholland.repository_hashicorp Build Status GitHub Build Status GitLab

Context

This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.

Here is an overview of related roles: dependencies

Compatibility

This role has been tested on these container images:

container tags
EL all
Amazon Candidate
Fedora 38, 39
Ubuntu all
Debian all

The minimum version of Ansible required is 2.10, tests have been done to:

  • The previous version.
  • The current version.
  • The development version.

If you find issues, please register them in GitHub.

License

MIT.

Author Information

Mullholland

Install
ansible-galaxy install mullholland.nomad
GitHub repository
License
apache-2.0
Downloads
142