<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto"><a href="http://docs.ansible.com/ansible/latest/include_vars_module.html#options" rel="nofollow"><code class="notranslate">include_vars</code></a></p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 2.4.0.0
  config file = None
  configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.4.0.0
  config file = None
  configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-config dump --only-changed
# nothing"><pre class="notranslate"><code class="notranslate">$ ansible-config dump --only-changed
# nothing
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Centos 7 (<code class="notranslate">Vagrantfile</code> below)</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto"><code class="notranslate">include_vars: dir</code> inside a role is only searching relative to the role. <a href="http://docs.ansible.com/ansible/latest/include_vars_module.html#options" rel="nofollow">The docs</a> suggest it also searches relative to the playbook. Either it's not searching both the owning role and the playbook directory, or the docs are wrong.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">I've put everything into <a href="https://github.com/thecjharries/ansible-include_vars-issue">a repo</a>; you can clone it and duplicate the problem.</p>
<p dir="auto"><code class="notranslate">role2/tasks/main.yml</code>:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- include_vars:
    dir: role1

- debug:
    var: role1_var"><pre class="notranslate">- <span class="pl-ent">include_vars</span>:
    <span class="pl-ent">dir</span>: <span class="pl-s">role1</span>

- <span class="pl-ent">debug</span>:
    <span class="pl-ent">var</span>: <span class="pl-s">role1_var</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;role1_var&quot;: &quot;This is from role 1&quot;"><pre class="notranslate"><code class="notranslate">"role1_var": "This is from role 1"
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto"><a href="https://github.com/thecjharries/ansible-include_vars-issue#results">A complete log</a> is in the repo; the specific problem is below:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;{{ playbook_dir }}/roles/role2/vars/role1 directory does not exist&quot;"><pre class="notranslate"><code class="notranslate">"{{ playbook_dir }}/roles/role2/vars/role1 directory does not exist"
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<ul dir="auto">
<li>azure_rm_virtualmachine</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.3.0
  config file = /home/admin/Code/ansible/ansible.cfg
  configured module search path = [u'/home/admin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Jan  5 2018, 10:41:29) [GCC 7.2.1 20171224]"><pre class="notranslate"><code class="notranslate">ansible 2.4.3.0
  config file = /home/admin/Code/ansible/ansible.cfg
  configured module search path = [u'/home/admin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Jan  5 2018, 10:41:29) [GCC 7.2.1 20171224]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="DEFAULT_VAULT_PASSWORD_FILE(/home/admin/Code/ansible/ansible.cfg) = /home/admin/Code/ansible/.vault_pass
RETRY_FILES_ENABLED(/home/admin/Code/ansible/ansible.cfg) = False
"><pre class="notranslate"><code class="notranslate">DEFAULT_VAULT_PASSWORD_FILE(/home/admin/Code/ansible/ansible.cfg) = /home/admin/Code/ansible/.vault_pass
RETRY_FILES_ENABLED(/home/admin/Code/ansible/ansible.cfg) = False

</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Arch Linux</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Deserialization error against the python sdk when attempting to create a virtual machine.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="  - name: Create {{vm_web_name}} virtual machine
    azure_rm_virtualmachine:
      client_id: &quot;{{azure_client_id}}&quot;
      secret: &quot;{{azure_secret}}&quot;
      tenant: &quot;{{azure_tenant}}&quot;
      subscription_id: &quot;{{azure_subscription}}&quot;
      resource_group: &quot;{{resource_group_name}}&quot;
      name: &quot;{{vm_web_name}}&quot;
      admin_username: &quot;{{vm_web_username}}&quot;
      image:
        offer: &quot;{{vm_web_image_offer}}&quot;
        publisher: &quot;{{vm_web_image_publisher}}&quot;
        sku: &quot;{{vm_web_image_sku}}&quot;
        version: &quot;{{vm_web_image_version}}&quot;
      location: &quot;{{vm_web_location}}&quot;
      managed_disk_type: &quot;Standard_LRS&quot;
      network_interface_names: &quot;{{nic_web_name}}&quot;
      ssh_password_enabled: False
      ssh_public_keys:
        - path: &quot;/home/{{vm_web_username}}/.ssh/authorized_keys&quot;
          key_data: &quot;{{vm_web_ssh}}&quot;
      vm_size: &quot;{{vm_web_size}}&quot;
      state: present
  "><pre class="notranslate">  - <span class="pl-ent">name</span>: <span class="pl-s">Create {{vm_web_name}} virtual machine</span>
    <span class="pl-ent">azure_rm_virtualmachine</span>:
      <span class="pl-ent">client_id</span>: <span class="pl-s"><span class="pl-pds">"</span>{{azure_client_id}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">secret</span>: <span class="pl-s"><span class="pl-pds">"</span>{{azure_secret}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">tenant</span>: <span class="pl-s"><span class="pl-pds">"</span>{{azure_tenant}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">subscription_id</span>: <span class="pl-s"><span class="pl-pds">"</span>{{azure_subscription}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">resource_group</span>: <span class="pl-s"><span class="pl-pds">"</span>{{resource_group_name}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_name}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">admin_username</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_username}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">image</span>:
        <span class="pl-ent">offer</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_image_offer}}<span class="pl-pds">"</span></span>
        <span class="pl-ent">publisher</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_image_publisher}}<span class="pl-pds">"</span></span>
        <span class="pl-ent">sku</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_image_sku}}<span class="pl-pds">"</span></span>
        <span class="pl-ent">version</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_image_version}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">location</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_location}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">managed_disk_type</span>: <span class="pl-s"><span class="pl-pds">"</span>Standard_LRS<span class="pl-pds">"</span></span>
      <span class="pl-ent">network_interface_names</span>: <span class="pl-s"><span class="pl-pds">"</span>{{nic_web_name}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">ssh_password_enabled</span>: <span class="pl-c1">False</span>
      <span class="pl-ent">ssh_public_keys</span>:
        - <span class="pl-ent">path</span>: <span class="pl-s"><span class="pl-pds">"</span>/home/{{vm_web_username}}/.ssh/authorized_keys<span class="pl-pds">"</span></span>
          <span class="pl-ent">key_data</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_ssh}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">vm_size</span>: <span class="pl-s"><span class="pl-pds">"</span>{{vm_web_size}}<span class="pl-pds">"</span></span>
      <span class="pl-ent">state</span>: <span class="pl-s">present</span>
  </pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">VM gets created</p>
<h5 dir="auto">ACTUAL RESULTS</h5>


<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="The full traceback is:
  File &quot;/tmp/ansible_9a4xdcrg/ansible_module_azure_rm_virtualmachine.py&quot;, line 1353, in create_or_update_vm
    poller = self.compute_client.virtual_machines.create_or_update(self.resource_group, self.name, params)
  File &quot;/usr/lib/python3.6/site-packages/azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py&quot;, line 242, in create_or_update
    **operation_config
  File &quot;/usr/lib/python3.6/site-packages/azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py&quot;, line 189, in _create_or_update_initial
    body_content = self._serialize.body(parameters, 'VirtualMachine')
  File &quot;/usr/lib/python3.6/site-packages/msrest/serialization.py&quot;, line 452, in body
    SerializationError, &quot;Unable to build a model: &quot;+str(err), err)
  File &quot;/usr/lib/python3.6/site-packages/msrest/exceptions.py&quot;, line 45, in raise_with_traceback
    raise error.with_traceback(exc_traceback)
  File &quot;/usr/lib/python3.6/site-packages/msrest/serialization.py&quot;, line 449, in body
    data = deserializer(data_type, data)
  File &quot;/usr/lib/python3.6/site-packages/msrest/serialization.py&quot;, line 973, in __call__
    self(local_type, value)
  File &quot;/usr/lib/python3.6/site-packages/msrest/serialization.py&quot;, line 973, in __call__
    self(local_type, value)
  File &quot;/usr/lib/python3.6/site-packages/msrest/serialization.py&quot;, line 973, in __call__
    self(local_type, value)
  File &quot;/usr/lib/python3.6/site-packages/msrest/serialization.py&quot;, line 985, in __call__
    return self.deserialize_enum(data, response)
  File &quot;/usr/lib/python3.6/site-packages/msrest/serialization.py&quot;, line 1296, in deserialize_enum
    raise DeserializationError(error.format(data, enum_obj))

    &quot;msg&quot;: &quot;Error creating or updating virtual machine VM-Web-PythonWeb - Unable to build a model: &lt;DiskCreateOptionTypes.from_image: 'FromImage'&gt; is not valid value for enum &lt;enum 'DiskCreateOptionTypes'&gt;, DeserializationError: &lt;DiskCreateOptionTypes.from_image: 'FromImage'&gt; is not valid value for enum &lt;enum 'DiskCreateOptionTypes'&gt;&quot;"><pre class="notranslate"><code class="notranslate">The full traceback is:
  File "/tmp/ansible_9a4xdcrg/ansible_module_azure_rm_virtualmachine.py", line 1353, in create_or_update_vm
    poller = self.compute_client.virtual_machines.create_or_update(self.resource_group, self.name, params)
  File "/usr/lib/python3.6/site-packages/azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py", line 242, in create_or_update
    **operation_config
  File "/usr/lib/python3.6/site-packages/azure/mgmt/compute/v2017_03_30/operations/virtual_machines_operations.py", line 189, in _create_or_update_initial
    body_content = self._serialize.body(parameters, 'VirtualMachine')
  File "/usr/lib/python3.6/site-packages/msrest/serialization.py", line 452, in body
    SerializationError, "Unable to build a model: "+str(err), err)
  File "/usr/lib/python3.6/site-packages/msrest/exceptions.py", line 45, in raise_with_traceback
    raise error.with_traceback(exc_traceback)
  File "/usr/lib/python3.6/site-packages/msrest/serialization.py", line 449, in body
    data = deserializer(data_type, data)
  File "/usr/lib/python3.6/site-packages/msrest/serialization.py", line 973, in __call__
    self(local_type, value)
  File "/usr/lib/python3.6/site-packages/msrest/serialization.py", line 973, in __call__
    self(local_type, value)
  File "/usr/lib/python3.6/site-packages/msrest/serialization.py", line 973, in __call__
    self(local_type, value)
  File "/usr/lib/python3.6/site-packages/msrest/serialization.py", line 985, in __call__
    return self.deserialize_enum(data, response)
  File "/usr/lib/python3.6/site-packages/msrest/serialization.py", line 1296, in deserialize_enum
    raise DeserializationError(error.format(data, enum_obj))

    "msg": "Error creating or updating virtual machine VM-Web-PythonWeb - Unable to build a model: &lt;DiskCreateOptionTypes.from_image: 'FromImage'&gt; is not valid value for enum &lt;enum 'DiskCreateOptionTypes'&gt;, DeserializationError: &lt;DiskCreateOptionTypes.from_image: 'FromImage'&gt; is not valid value for enum &lt;enum 'DiskCreateOptionTypes'&gt;"
</code></pre></div>
<h4 dir="auto">Extra info</h4>
<p dir="auto">I did some debugging and got this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{'id': None, 'name': None, 'type': None, 'location': 'westeurope', 'tags': None, 'plan': None, 'hardware_profile':
&lt;azure.mgmt.compute.v2017_12_01.models.hardware_profile.HardwareProfile object at 0x7fad68594550&gt;, 'storage_profile':
&lt;azure.mgmt.compute.v2017_12_01.models.storage_profile.StorageProfile object at 0x7fad685946a0&gt;, 'os_profile':
&lt;azure.mgmt.compute.v2017_12_01.models.os_profile.OSProfile object at 0x7fad687efac8&gt;, 'network_profile':
&lt;azure.mgmt.compute.v2017_12_01.models.network_profile.NetworkProfile object at 0x7fad685945f8&gt;, 'diagnostics_profile': None, 'availability_set': None,
'provisioning_state': None, 'instance_view': None, 'license_type': None, 'vm_id': None, 'resources': None, 'identity': None, 'zones': None}"><pre class="notranslate"><code class="notranslate">{'id': None, 'name': None, 'type': None, 'location': 'westeurope', 'tags': None, 'plan': None, 'hardware_profile':
&lt;azure.mgmt.compute.v2017_12_01.models.hardware_profile.HardwareProfile object at 0x7fad68594550&gt;, 'storage_profile':
&lt;azure.mgmt.compute.v2017_12_01.models.storage_profile.StorageProfile object at 0x7fad685946a0&gt;, 'os_profile':
&lt;azure.mgmt.compute.v2017_12_01.models.os_profile.OSProfile object at 0x7fad687efac8&gt;, 'network_profile':
&lt;azure.mgmt.compute.v2017_12_01.models.network_profile.NetworkProfile object at 0x7fad685945f8&gt;, 'diagnostics_profile': None, 'availability_set': None,
'provisioning_state': None, 'instance_view': None, 'license_type': None, 'vm_id': None, 'resources': None, 'identity': None, 'zones': None}
</code></pre></div>
<p dir="auto">which looks like its using compute client models from <code class="notranslate">v2017_12_01</code></p>
<p dir="auto">however it looks like the <code class="notranslate">compute_client</code> we are using is <code class="notranslate">v2017_03_03</code><br>
<a href="https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/azure_rm_common.py#L910">https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/azure_rm_common.py#L910</a></p>
<p dir="auto">I changed it to <code class="notranslate">2017-12-01</code> and it worked for me.</p>