title: How to get current hostname from Ansible module?
body: <p>I'm developing custom Ansible module to control Vagrant controlled multiple VM nodes on multiple VM servers following guide <a href="https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html" rel="nofollow noreferrer">https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html</a>. As far as I understand, Ansible iterates over all specified target hosts and executes <code>run_module</code> on them, allowing to <code>module.run_command</code> on each host.</p>
  
  <p>But I need to know on which host I am executing current command. I can add <code>remote_host={{ inventory_hostname }}</code> to <code>MODULE_ARGS</code> (<code>-a</code> option of <code>ansible</code>) and then access it as <code>module.params['remote_host']</code> but it is not very convenient. Is there other way to get hostname directly from Ansible module Python code?</p>