ansible-community / ansible-nomad

:watch: Ansible role for Nomad
https://galaxy.ansible.com/brianshumate/nomad
BSD 2-Clause "Simplified" License
298 stars 166 forks source link

Error loading /etc/nomad.d/client.hcl: illegal char #66

Closed heri16 closed 4 years ago

heri16 commented 5 years ago

I am getting an "illegal char error" with my client.hcl when using nomad_chroot_env.

This line seems to be incorrect: https://github.com/brianshumate/ansible-nomad/blob/b37e501c5ff320e85fc10bc4d638285aec027867/templates/client.hcl.j2#L35

What the template generated

client {
    enabled = true

    chroot_env = {
    "/etc/local.resolv.conf": "/etc/resolv.conf",
    "/run/systemd/resolve": "/run/systemd/resolve"
}
    }

What the template should have generated

client {
    enabled = true

    chroot_env = {
    "/etc/local.resolv.conf" = "/etc/resolv.conf",
    "/run/systemd/resolve" = "/run/systemd/resolve"
}
    }
heri16 commented 5 years ago

Looks like we have the same issue with nomad_config_custom:

https://github.com/brianshumate/ansible-nomad/blob/06a551249d15995c4c6ff69376063b407cd1c165/templates/custom.hcl.j2#L3

tommyalatalo commented 4 years ago

Just came here to mention the same issue with nomad_chroot_env which I just stumbled upon. HCL and JSON are mixed in the client.hcl file which crashes Nomad.

nomad_config_custom however works for me, since that property creates a new file ("custom.hcl") and is not mixing hcl and json in the file contents. The custom.hcl file is wrong in the sense that it is actually json and not hcl, so yes, both of these should still be looked at.

OneCricketeer commented 4 years ago

Closed with #69?

lanefu commented 4 years ago

assuming closed by #69