Open bradleydwyer opened 3 years ago
As a possible fix, but not well tested:
{{ key | indent(count*width, first=True) }} = {% if value is string %}"{{ value }}"{% elif value is iterable and (value is not string and value is not mapping) -%}[{% set comma = joiner(",") %}{% for item in value %}{{ comma() }}"{{ item | string }}"{% endfor %}]{% else %}{{ value | string | lower }}{% endif %}
Replacing L74 from client.hcl.j2
Can submit a pull request if you think it's a valid fix. It seems to resolve my issue and doesn't appear to break other items I currently use in the docker config section - but I wouldn't call it well tested at all.
Pull request is #128
Was just trying to add the a capability to the Docker plugin (in my case, NET_ADMIN) and noticed that the generated client.hcl isn't accepted by Nomad on startup.
Given the Ansible YAML config of:
The generated HCL is (that Nomad rejects):
Where I would have expected (and Nomad happily starts with):
I also tried a list format for the YAML
But it had the same output.
I presume the lowercase originates from https://github.com/ansible-community/ansible-nomad/blob/a1853f1cf1051f72ca4b3fc672a56686b42efce6/templates/client.hcl.j2#L74 and I'm happy to change it, but I'm not sure why it's there in the first place, so I'm a little hesitant to just go changing it to solve my specific problem.