title: How can I use Foreman host groups with Puppet?
body: <p>I have this manifest:</p>
  
  <pre><code>$foremanlogin = file('/etc/puppetlabs/code/environments/production/manifests/foremanlogin.txt')
  $foremanpass = file('/etc/puppetlabs/code/environments/production/manifests/foremanpass.txt')
  
  $query = foreman({foreman_user =&gt; "$foremanlogin",
                    foreman_pass =&gt; "$foremanpass",
                    item         =&gt; 'hosts',
                    search       =&gt; 'hostgroup = "Web Servers"',
  filter_result =&gt; 'name',
  })
  
  $quoted = regsubst($query, '(.*)', '"\1"')
  $query6 = join($quoted, ",")
  
  notify{"The value is: ${query6}": }
  
  node ${query6} {
  
  package { 'atop':
      ensure =&gt; 'installed',
    }
  
  }
  </code></pre>
  
  <p>When I execute this on agent I got error:</p>
  
  <pre><code>Server Error: Could not parse for environment production: Syntax error at ''
  </code></pre>
  
  <p>Error in my node block</p>
  
  <pre><code>node ${query6} {
  
  package { 'atop':
      ensure =&gt; 'installed',
    }
  
  }
  </code></pre>
  
  <p>I see correct output from notify, my variable looks like this:</p>
  
  <pre><code>"test-ubuntu1","test-ubuntu2"
  </code></pre>
  
  <p>Variable in correct node manifest format.</p>
  
  <p>I don't understand whats wrong? variable query6 is correct.</p>
  
  <p>How to fix that?</p>