title: Dynamic inventory groups from ansible plugin: nmap
body: <p>I'm trying to use the <a href="https://docs.ansible.com/ansible/latest/plugins/inventory/nmap.html" rel="nofollow noreferrer">nmap plugin</a> in ansible to create a dynamic inventory, and then group things that the plugin returns. Unfortunately, I'm missing something, because I can't seem to get a group to be created.<br>
  In this scenario, I have a couple hosts named unknownxxxxxxxx that I would like to group. </p>
  
  <pre><code>plugin: nmap
  strict: false
  address: 10.0.1.0/24   
  ports: no
  groups:
    unknown: "'unknown' in hostname"
  </code></pre>
  
  <p>I run my plugin - 
  <code>ansible-inventory -i nmap.yml --export --output=inv --list</code></p>
  
  <p>but the return is always the same...</p>
  
  <p>By now, I've resorted to guessing possible var names</p>
  
  <blockquote>
    <p>host, hosts, hostnames, hostname, inventory_hostname, hostvars, host.fqdn, and the list goes on and on...</p>
  </blockquote>
  
  <p>I'm obviously missing something basic, but I can't seem to find anything via search that has yielded any results.</p>
  
  <p>Can someone help me understand what I'm doing wrong with jinja? </p>
  
  <p>Perhaps I need to use <code>compose:</code> and <code>keyed_groups:</code> ?</p>