datacenter = "dc1"
data_dir = "/opt/nomad/data"
plugin_dir = "/opt/nomad/plugins"
log_level = "INFO"
name = "{{ inventory_hostname }}"

bind_addr = "{{ inventory_hostname }}.tailnet-68f9.ts.net"

addresses {
  http = "{{ inventory_hostname }}.tailnet-68f9.ts.net"
  rpc  = "{{ inventory_hostname }}.tailnet-68f9.ts.net"
  serf = "{{ inventory_hostname }}.tailnet-68f9.ts.net"
}

advertise {
  http = "{{ inventory_hostname }}.tailnet-68f9.ts.net:4646"
  rpc  = "{{ inventory_hostname }}.tailnet-68f9.ts.net:4647"
  serf = "{{ inventory_hostname }}.tailnet-68f9.ts.net:4648"
}

ports {
  http = 4646
  rpc  = 4647
  serf = 4648
}

server {
  enabled = false
}

client {
  enabled = true
  network_interface = "tailscale0"
  
  servers = [
    "semaphore.tailnet-68f9.ts.net:4647",
    "ash1d.tailnet-68f9.ts.net:4647",
    "ash2e.tailnet-68f9.ts.net:4647",
    "ch2.tailnet-68f9.ts.net:4647",
    "ch3.tailnet-68f9.ts.net:4647",
    "onecloud1.tailnet-68f9.ts.net:4647",
    "de.tailnet-68f9.ts.net:4647"
  ]
  
  meta {
    consul = "true"
    consul_version = "1.21.5"
    consul_server = "{% if inventory_hostname in ['master', 'ash3c', 'warden'] %}true{% else %}false{% endif %}"
  }
  
  # 激进的垃圾清理策略
  gc_interval = "5m"
  gc_disk_usage_threshold = 80
  gc_inode_usage_threshold = 70
}

plugin "nomad-driver-podman" {
  config {
    socket_path = "unix:///run/podman/podman.sock"
    volumes {
      enabled = true
    }
  }
}

consul {
  address = "warden.tailnet-68f9.ts.net:8500"
  server_service_name = "nomad"
  client_service_name = "nomad-client"
  auto_advertise = true
  server_auto_join = true
  client_auto_join = true
}

vault {
  enabled = true
  address = "http://warden.tailnet-68f9.ts.net:8200"
  token = "hvs.A5Fu4E1oHyezJapVllKPFsWg"
  create_from_role = "nomad-cluster"
  tls_skip_verify = true
}
