title: Ansible dynamic inventory refresh
body: <p>I have created a simple dynamic inventory python which prints JSON to standard output mentioned below, but Ansible inventory does not refresh. </p>
  
  <p>Command: <code>ansible-playbook playbooks/deploy.yaml -i playbook/inventory_test.py</code></p>
  
  <p>Inventory JSON: </p>
  
  <pre><code>{
      'python_hosts': {
          'hosts': ['10.220.21.122', '10.220.21.278'],
          'vars': {
              'ansible_ssh_user': 'projectuser',
          }
      },
      '_meta': {
          'hostvars': {
              '10.220.21.122': {
                  'host_specific_var': 'testhost'
              },
              '10.220.21.278': {
                  'host_specific_var': 'towerhost'
              }
          }
      }
  } 
  </code></pre>
  
  <p>I also tried this:</p>
  
  <pre><code>- hosts: localhost
  
    tasks:
  
    - name: test
      script: ./inventory_test.py
  
    - name: Refresh inventory
      meta: refresh_inventory
  
    - name: print new inventory
      debug:
        var: groups
  </code></pre>
  
  <p>But inventory still does not refresh automatically. </p>
  
  <p>Ansible version is 2.6.4</p>
  
  <p>Any help on this is really appreciated. </p>