title: How to declare a variable and reuse it in icinga2 hosts section?
body: <p>For now I use the below config for Icinga2 host server to work:</p>
  
  <pre><code>vars.health_check["my_module1"]={
     host = "HEALTH_CHECK_SERVER_URL"
     module = "my_module1"
  }
  
  vars.health_check["my_module2"]={
     host = "HEALTH_CHECK_SERVER_URL"
     module = "my_module2"
  }
  </code></pre>
  
  <p>The problem as you see is that I have to redeclare the same host address. When I put the host address outside of service like below, it does not work and reloading of <code>Icinga2</code> fails:  </p>
  
  <pre><code>   end_url = "HEALTH_CHECK_SERVER_URL"
     vars.health_check["my_module1"]={
         host = "$end_url$"
         module = "my_module1"
      }
  
      vars.health_check["my_module2"]={
         host = "$end_url$"
         module = "my_module2"
      }
  </code></pre>
  
  <p>I even tried to use <code>vars.end_url</code> but again the same scenario. How should I declare a variable in <code>Icinga2</code>.</p>