Open
Description
Summary
Nomad supports input variables to jobs via either environment variables, input files, or passed as arguments as seen in the documentation. This allows better input validation compared to simply templating it in via Ansible as well as some other logic that comes with HCL, such as functions and dynamic
blocks.
Issue Type
Feature Idea
Component Name
nomad_job
Additional Information
- name: Start nomad job with input file
community.general.nomad_job:
host: <host>
content: "{{ lookup('ansible.builtin.file', 'job.hcl') }}"
input_vars: "{{ lookup('ansible.builtin.file', 'vars.hcl') }}" # Could be JSON as well, perhaps even just a straight up YAML object?
state: present
use_ssl: false
validate_certs: false
or via environment variables:
- name: Start nomad job with input file
community.general.nomad_job:
host: <host>
content: "{{ lookup('ansible.builtin.file', 'job.hcl') }}"
state: present
use_ssl: false
validate_certs: false
environment:
NOMAD_VAR_myvar: "Hello There!"
I've tried the environment variable option but it seems to get ignored, as I would assume python-nomad
doesn't support it.
Code of Conduct
- I agree to follow the Ansible Code of Conduct