On this page
community.general.nomad_job – Launch a Nomad Job
Note
This plugin is part of the community.general collection (version 3.8.1).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.nomad_job
.
New in version 1.3.0: of community.general
Synopsis
- Launch a Nomad job.
- Stop a Nomad job.
- Force start a Nomad job
Requirements
The below requirements are needed on the host that executes this module.
- python-nomad
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
client_cert
path
|
Path of certificate for TLS/SSL.
|
|
client_key
path
|
Path of certificate's private key for TLS/SSL.
|
|
content
string
|
Content of Nomad job.
Either this or name must be specified.
|
|
content_format
string
|
|
Type of content of Nomad job.
|
force_start
boolean
|
|
Force job to started.
|
host
string / required
|
FQDN of Nomad server.
|
|
name
string
|
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 content must be specified.
|
|
namespace
string
|
Namespace for Nomad.
|
|
state
string / required
|
|
Deploy or remove job.
|
timeout
integer
|
Default:
5
|
Timeout (in seconds) for the request to Nomad.
|
token
string
|
ACL token for authentification.
|
|
use_ssl
boolean
|
|
Use TLS/SSL connection.
|
validate_certs
boolean
|
|
Enable TLS/SSL certificate validation.
|
Notes
Note
check_mode
is supported.
See Also
See also
- Nomad jobs documentation
-
Complete documentation for Nomad API jobs.
Examples
- name: Create job
community.general.nomad_job:
host: localhost
state: present
content: "{{ lookup('ansible.builtin.file', 'job.hcl') }}"
timeout: 120
- name: Stop job
community.general.nomad_job:
host: localhost
state: absent
name: api
- name: Force job to start
community.general.nomad_job:
host: localhost
state: present
name: api
timeout: 120
force_start: true
Authors
- FERREIRA Christophe (@chris93111)
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/nomad_job_module.html