wescale / hashistack

Ansible collections for HashiCorp Vault-Consul-Nomad platform automation
MIT License
59 stars 32 forks source link

Nomad. External network not available (Could not resolve host) in bridge mode #66

Closed makp0 closed 1 year ago

makp0 commented 1 year ago

More like a tip for others. May be worth adding to docs.

job "test" {
    datacenters = ["devone"]

    group "test_group" {
        network {
            mode = "bridge"
            dns {
              servers = ["10.194.3.12", "10.194.3.3"]
            }
        }

        task "clone_hashistack" {
            driver = "exec"

            config {
                command = "/bin/bash"
                args    = ["-c", "rm -rf hashistack && git clone https://github.com/wescale/hashistack.git"]
            }
        }
    }
}

network.dns.servers = ["10.194.3.12", "10.194.3.3"]are specific to Scaleway.

Without them job will fail with:

Cloning into 'hashistack'... fatal: unable to access 'https://github.com/wescale/hashistack.git/': Could not resolve host: github.com

Extracted by running resolvectl in a Scaleway instance:

resolvectl Global Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported resolv.conf mode: stub

Link 2 (ens2) Current Scopes: DNS Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported Current DNS Server: 10.194.3.12 DNS Servers: 10.194.3.12 10.194.3.3

Idea for the fix taken from here