title: ansible action plugin expand ansible fact
body: <p>i have been trying to use what is here in order to pass the hostname to a module </p>
  
  <p><a href="https://stackoverflow.com/questions/45074728/use-ansible-facts-in-module-code#45082984">use ansible_facts in module code</a></p>
  
  <p>i have the code  below which normally will create a fact which i can after use with the template or copy module to copy a file remotely. </p>
  
  <pre><code>#!/usr/bin/python
  
  import custommodule 
  
  # ...
  
  hostname = {{ ansible_nodename }}  # hostname should come from ansible_nodename fact. 
  
  custom_content = custommodule.render(hostname)
  
  facts = dict()
  facts['custom_content'] = custom_content
  args = {
      'changed': False,
      'ansible_facts': {'custom_facts': facts},
  }
  module.exit_json(**args)
  </code></pre>
  
  <p>the question is how to make sure that the variable <code>hostname</code>is populated by the fact <code>ansible_nodename</code> I do not know how implement that. </p>
  
  <p>how could I modify this </p>