community.general.nomad_job_info – Get Nomad Jobs info

Note

This plugin is part of the community.general collection (version 1.3.2).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.nomad_job_info.

New in version 1.3.0: of community.general

Synopsis

  • Get info for one Nomad job.
  • List Nomad jobs.

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.
host
string / required
FQDN of Nomad server.
name
string
Name of job for Get info.
If not specified, lists all jobs.
namespace
string
Namespace for Nomad.
timeout
integer
Default:
5
Timeout (in seconds) for the request to Nomad.
token
string
ACL token for authentification.
use_ssl
boolean
    Choices:
  • no
  • yes
Use TLS/SSL connection.
validate_certs
boolean
    Choices:
  • no
  • yes
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: Get info for job awx
  community.general.nomad_job:
    host: localhost
    name: awx
  register: result

- name: List Nomad jobs
  community.general.nomad_job:
    host: localhost
  register: result

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
result
list / elements=string
success
List with dictionary contains jobs info

Sample:
[{'Affinities': None, 'AllAtOnce': False, 'Constraints': None, 'ConsulToken': '', 'CreateIndex': 13, 'Datacenters': ['dc1'], 'Dispatched': False, 'ID': 'example', 'JobModifyIndex': 13, 'Meta': None, 'ModifyIndex': 13, 'Multiregion': None, 'Name': 'example', 'Namespace': 'default', 'NomadTokenID': '', 'ParameterizedJob': None, 'ParentID': '', 'Payload': None, 'Periodic': None, 'Priority': 50, 'Region': 'global', 'Spreads': None, 'Stable': False, 'Status': 'pending', 'StatusDescription': '', 'Stop': False, 'SubmitTime': 1602244370615307000, 'TaskGroups': [{'Affinities': None, 'Constraints': None, 'Count': 1, 'EphemeralDisk': {'Migrate': False, 'SizeMB': 300, 'Sticky': False}, 'Meta': None, 'Migrate': {'HealthCheck': 'checks', 'HealthyDeadline': 300000000000, 'MaxParallel': 1, 'MinHealthyTime': 10000000000}, 'Name': 'cache', 'Networks': None, 'ReschedulePolicy': {'Attempts': 0, 'Delay': 30000000000, 'DelayFunction': 'exponential', 'Interval': 0, 'MaxDelay': 3600000000000, 'Unlimited': True}, 'RestartPolicy': {'Attempts': 3, 'Delay': 15000000000, 'Interval': 1800000000000, 'Mode': 'fail'}, 'Scaling': None, 'Services': None, 'ShutdownDelay': None, 'Spreads': None, 'StopAfterClientDisconnect': None, 'Tasks': [{'Affinities': None, 'Artifacts': None, 'CSIPluginConfig': None, 'Config': {'image': 'redis:3.2', 'port_map': [{'db': 6379.0}]}, 'Constraints': None, 'DispatchPayload': None, 'Driver': 'docker', 'Env': None, 'KillSignal': '', 'KillTimeout': 5000000000, 'Kind': '', 'Leader': False, 'Lifecycle': None, 'LogConfig': {'MaxFileSizeMB': 10, 'MaxFiles': 10}, 'Meta': None, 'Name': 'redis', 'Resources': {'CPU': 500, 'Devices': None, 'DiskMB': 0, 'IOPS': 0, 'MemoryMB': 256, 'Networks': [{'CIDR': '', 'DNS': None, 'Device': '', 'DynamicPorts': [{'HostNetwork': 'default', 'Label': 'db', 'To': 0, 'Value': 0}], 'IP': '', 'MBits': 10, 'Mode': '', 'ReservedPorts': None}]}, 'RestartPolicy': {'Attempts': 3, 'Delay': 15000000000, 'Interval': 1800000000000, 'Mode': 'fail'}, 'Services': [{'AddressMode': 'auto', 'CanaryMeta': None, 'CanaryTags': None, 'Checks': [{'AddressMode': '', 'Args': None, 'CheckRestart': None, 'Command': '', 'Expose': False, 'FailuresBeforeCritical': 0, 'GRPCService': '', 'GRPCUseTLS': False, 'Header': None, 'InitialStatus': '', 'Interval': 10000000000, 'Method': '', 'Name': 'alive', 'Path': '', 'PortLabel': '', 'Protocol': '', 'SuccessBeforePassing': 0, 'TLSSkipVerify': False, 'TaskName': '', 'Timeout': 2000000000, 'Type': 'tcp'}], 'Connect': None, 'EnableTagOverride': False, 'Meta': None, 'Name': 'redis-cache', 'PortLabel': 'db', 'Tags': ['global', 'cache'], 'TaskName': ''}], 'ShutdownDelay': 0, 'Templates': None, 'User': '', 'Vault': None, 'VolumeMounts': None}], 'Update': {'AutoPromote': False, 'AutoRevert': False, 'Canary': 0, 'HealthCheck': 'checks', 'HealthyDeadline': 180000000000, 'MaxParallel': 1, 'MinHealthyTime': 10000000000, 'ProgressDeadline': 600000000000, 'Stagger': 30000000000}, 'Volumes': None}], 'Type': 'service', 'Update': {'AutoPromote': False, 'AutoRevert': False, 'Canary': 0, 'HealthCheck': '', 'HealthyDeadline': 0, 'MaxParallel': 1, 'MinHealthyTime': 0, 'ProgressDeadline': 0, 'Stagger': 30000000000}, 'VaultNamespace': '', 'VaultToken': '', 'Version': 0}]


Authors

  • FERREIRA Christophe (@chris93111)

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/nomad_job_info_module.html