title: how to get ansible inventory file name as a variable
body: <p>I have a situation where three Jenkins jobs running which uses ansible for the deployment. This jobs uses there own inventory files like /opt/abc/ci1.inventory, /opt/abc/ci2.inventory, /opt/abc/ci3.inventory etc. For example if first jenkins job is running it will use /opt/abc/ci1.inventory file. </p>
  
  <p>I have a ansible template where I have one variable "jenkins_ci_job" which I want to assign a value according to the jenkins job running. For example if job 1 is running then it will assign the value "ci1" to "jenkins_ci_job" variable. The only way I see is to get the inventory file name and search if it contains the job name. </p>
  
  <p>So I am searching for something like this</p>
  
  <pre><code> jenkins_ci_job:
      "{{ 'ci1' if &lt;ansible_inventory_full_path_name&gt; contains 'ci1' else 'ci2' if &lt;ansible_inventory_full_path_name&gt; contains 'ci2 else 'ci3' }}"
  </code></pre>