community.general.nomad_job (8.5.0) — module

Launch a Nomad Job

| "added in version" 1.3.0 of community.general"

Authors: FERREIRA Christophe (@chris93111)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Launch a Nomad job.

Stop a Nomad job.

Force start a Nomad job


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create job
  community.general.nomad_job:
    host: localhost
    state: present
    content: "{{ lookup('ansible.builtin.file', 'job.hcl') }}"
    timeout: 120
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Connect with port to create job
  community.general.nomad_job:
    host: localhost
    port: 4645
    state: present
    content: "{{ lookup('ansible.builtin.file', 'job.hcl') }}"
    timeout: 120
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stop job
  community.general.nomad_job:
    host: localhost
    state: absent
    name: api
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Force job to start
  community.general.nomad_job:
    host: localhost
    state: present
    name: api
    timeout: 120
    force_start: true

Inputs

    
host:
    description:
    - FQDN of Nomad server.
    required: true
    type: str

name:
    description:
    - Name of job for delete, stop and start job without source.
    - Name of job for delete, stop and start job without source.
    - Either this or O(content) must be specified.
    type: str

port:
    default: 4646
    description:
    - Port of Nomad server.
    type: int
    version_added: 8.0.0
    version_added_collection: community.general

state:
    choices:
    - present
    - absent
    description:
    - Deploy or remove job.
    required: true
    type: str

token:
    description:
    - ACL token for authentication.
    type: str

content:
    description:
    - Content of Nomad job.
    - Either this or O(name) must be specified.
    type: str

timeout:
    default: 5
    description:
    - Timeout (in seconds) for the request to Nomad.
    type: int

use_ssl:
    default: true
    description:
    - Use TLS/SSL connection.
    type: bool

namespace:
    description:
    - Namespace for Nomad.
    type: str

client_key:
    description:
    - Path of certificate's private key for TLS/SSL.
    type: path

client_cert:
    description:
    - Path of certificate for TLS/SSL.
    type: path

force_start:
    default: false
    description:
    - Force job to started.
    type: bool

content_format:
    choices:
    - hcl
    - json
    default: hcl
    description:
    - Type of content of Nomad job.
    type: str

validate_certs:
    default: true
    description:
    - Enable TLS/SSL certificate validation.
    type: bool

See also