title: Setting values based upon whether the host ID exists in a list
body: <p>I am trying to create a state where a handful of settings can be retrieved without me having to make lots of individual pillar files for all the hosts. This way seems tedious and incorrect but I can't wrap my head around how to do it with Jinja and YAML.</p>
  <p>How I was doing it:</p>
  <p>/srv/pillar
  hosts1.sls,host2.sls,host3.sls,...host1000</p>
  <pre><code>cluster:
    name: cluster_one
    server: 1.1.1.1
    setting: foo
  </code></pre>
  <p>/srv/pillar
  hosts4.sls,host5.sls,host6.sls,...</p>
  <pre><code>cluster:
    name: cluster_two
    server: 2.2.2.2
    setting: bar
  </code></pre>
  <p>Is it possible to do something like this with pillar or even a map.jinja file and then use Jinja to in a state file and say 'if my minion name is in the members list, then set these server, setting and cluster name'?</p>
  <pre><code>clusters:
    cluster_one:
      server: 1.1.1.1
      setting: foo
      members:
         - host1
         - host2
         - host3
    cluster_two
      server: 2.2.2.2
      setting: bar
      members:
        - host4
        - host5
        - host6
  </code></pre>
  <p>The end result I wanted is just those three lines in a file like this.</p>
  <p>host1,host2,host3
  /tmp/example.txt</p>
  <pre><code>name: cluster_one
  server: 1.1.1.1
  setting: foo
  </code></pre>
  <p>host4,host5,host6
  /tmp/example.txt</p>
  <pre><code>name: cluster_two
  server: 2.2.2.2
  setting: bar
  </code></pre>
  <p>The idea being that I want to just be able add minions to the members list without then having to make tons of new pillar files for each host. A host would only appear in one cluster so no need to worry about matching.</p>
  <p>Then if I wanted to add new members I could simple edit this (refresh if needed) and apply without having to create new pillar files for host7, host8, and host9.</p>
  <pre><code>clusters:
    cluster_one:
      server: 1.1.1.1
      setting: foo
      members:
         - host1
         - host2
         - host3
    cluster_two
      server: 2.2.2.2
      setting: bar
      members:
        - host4
        - host5
        - host6
   cluster_three
     server: 3.3.3.3
     setting: baz
     members:
       - host7
       - host8
       - host9
   
  </code></pre>