Consul-template if else condition

Viewed 7863

I have below consul-template.

{{ range service "mysql_slave.mysql" "any" }}
host_name                      {{.Node}}
command                        check_nrpe!check_procs_1
{{end}}

I want to add if my hostname match "database-1" then command "check_procs_1" and others command "check_procs_2"

output

host_name                      node_server
command                        check_nrpe!check_procs_2

host_name                      database-1
command                        check_nrpe!check_procs_1

host_name                      webserver
command                        check_nrpe!check_procs_2
1 Answers
Related