<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">Module: ansible/lib/ansible/modules/packaging/language/pip.py</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.2.0.0
config file = 
configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.2.0.0
config file = 
configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">No base config</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.4 LTS
Release:	14.04
Codename:	trusty"><pre class="notranslate"><code class="notranslate">$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.4 LTS
Release:	14.04
Codename:	trusty
</code></pre></div>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">The pip module verifies that python libraries with a particular version are installed on the target host. However, it does not support range versions.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">With support for a range version, the module could be used in a task as follows-</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- name: Verify dependencies
  pip:
    name: docker-py
    version: &gt; 1.7.0"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">Verify dependencies</span>
  <span class="pl-ent">pip</span>:
    <span class="pl-ent">name</span>: <span class="pl-s">docker-py</span>
    <span class="pl-ent">version</span>: <span class="pl-s">&gt; 1.7.0</span></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">module/cloud/azure/azure_rm_virtualmachine</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.2.0
  config file = None
  configured module search path = [u'/root/.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 2.4.2.0
  config file = None
  configured module search path = [u'/root/.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=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Docker library/centos</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Creating virtual machines on Azure Stack fails because managed disks is not supported.</p>
<p dir="auto">After spending a lot of time working with the Azure python SDK teams to work around issues with authentication and API versions most objects work correctly however virtual machine creation fails.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">The steps to reproduce are complicated as changes have to be made to the fix auth, API and model versions for the azure python client to support Azure Stack and a fix to resolve the endpoints provided by Azure Stack via the metadata endpoint.</p>
<p dir="auto">Obviously an Azure Stack is required to test and for anyone helping with development we have a lab are happy to get people access to.</p>
<p dir="auto">To make the process easier the following docker container can be used, which implements these fixes.</p>
<p dir="auto">docker pull charliejllewellyn/azure-tooling:v0.2</p>
<p dir="auto">The code to build the container is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FROM library/centos

RUN yum install -y unzip epel-release gcc python-dev openssl git python2-devel ca-certificates vim &amp;&amp; yum clean all
RUN yum install -y python-pip &amp;&amp; yum clean all
RUN pip install --upgrade pip
RUN pip install ansible[azure]
RUN pip install azure-cli
RUN update-ca-trust force-enable
# Fix for broken authentication
# - https://github.com/Azure/azure-sdk-for-python/issues/1669
RUN sed -i 's/self.cloud_environment.endpoints.management/self.cloud_environment.endpoints.active_directory_resource_id/g' /usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py
# Fix for hardcoded API's
# - https://github.com/ansible/ansible/issues/26195
# - https://github.com/Azure/azure-sdk-for-python/issues/1696
RUN sed -i '716s/2017-06-01/2016-01-01/g' /usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common.py
RUN sed -i 's/2017_06_01/2016_01_01/g' /usr/lib/python2.7/site-packages/azure/mgmt/storage/models.py
RUN sed -i '743s/2017-03-30/2016-03-30/g' /usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common.py
RUN sed -i 's/See link below for details./See link below for details.\nfrom .v2016_03_30.models import */g' /usr/lib/python2.7/site-packages/azure/mgmt/compute/models.py
RUN sed -i '725s/2017-06-01/2015-06-15/g' /usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common.py
# Fix for lack of storage API with Azure Stack
# - https://github.com/Azure/msrestazure-for-python/issues/64
RUN sed -i &quot;s/requested_vhd_uri \= 'https:\/\/{0}.blob.{1}\/{2}\/{3}'.format(self.storage_account_name,/requested_vhd_uri \= '{0}{1}\/{2}'.format(properties.primary_endpoints.blob,/g&quot; /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
RUN sed -i '/self._cloud_environment.suffixes.storage_endpoint,/d' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
RUN sed -i 's/self.get_storage_account(self.storage_account_name)/properties = self.get_storage_account(self.storage_account_name)/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py"><pre class="notranslate"><code class="notranslate">FROM library/centos

RUN yum install -y unzip epel-release gcc python-dev openssl git python2-devel ca-certificates vim &amp;&amp; yum clean all
RUN yum install -y python-pip &amp;&amp; yum clean all
RUN pip install --upgrade pip
RUN pip install ansible[azure]
RUN pip install azure-cli
RUN update-ca-trust force-enable
# Fix for broken authentication
# - https://github.com/Azure/azure-sdk-for-python/issues/1669
RUN sed -i 's/self.cloud_environment.endpoints.management/self.cloud_environment.endpoints.active_directory_resource_id/g' /usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py
# Fix for hardcoded API's
# - https://github.com/ansible/ansible/issues/26195
# - https://github.com/Azure/azure-sdk-for-python/issues/1696
RUN sed -i '716s/2017-06-01/2016-01-01/g' /usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common.py
RUN sed -i 's/2017_06_01/2016_01_01/g' /usr/lib/python2.7/site-packages/azure/mgmt/storage/models.py
RUN sed -i '743s/2017-03-30/2016-03-30/g' /usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common.py
RUN sed -i 's/See link below for details./See link below for details.\nfrom .v2016_03_30.models import */g' /usr/lib/python2.7/site-packages/azure/mgmt/compute/models.py
RUN sed -i '725s/2017-06-01/2015-06-15/g' /usr/lib/python2.7/site-packages/ansible/module_utils/azure_rm_common.py
# Fix for lack of storage API with Azure Stack
# - https://github.com/Azure/msrestazure-for-python/issues/64
RUN sed -i "s/requested_vhd_uri \= 'https:\/\/{0}.blob.{1}\/{2}\/{3}'.format(self.storage_account_name,/requested_vhd_uri \= '{0}{1}\/{2}'.format(properties.primary_endpoints.blob,/g" /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
RUN sed -i '/self._cloud_environment.suffixes.storage_endpoint,/d' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
RUN sed -i 's/self.get_storage_account(self.storage_account_name)/properties = self.get_storage_account(self.storage_account_name)/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
</code></pre></div>
<p dir="auto">FYI...I am not proud of this ;)</p>
<p dir="auto">You then have to save the Azure Stack self signed root cert to /etc/pki/ca-trust/source/anchors/azurestack-physical.cer and import it to the trusted ca store.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="update-ca-trust force-enable
update-ca-trust extract
export REQUESTS_CA_BUNDLE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
cat /root/.azure/azurestack-physical.cer &gt;&gt; /usr/lib/python2.7/site-packages/certifi/cacert.pem"><pre class="notranslate"><code class="notranslate">update-ca-trust force-enable
update-ca-trust extract
export REQUESTS_CA_BUNDLE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
cat /root/.azure/azurestack-physical.cer &gt;&gt; /usr/lib/python2.7/site-packages/certifi/cacert.pem
</code></pre></div>
<p dir="auto">Create a file /root/.azure/credentials with the following content:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[default]
ad_user=username@azurestack-domain
password=xxxxxxxxxxx
subscription_id=&lt;subscription id&gt;
cloud_environment=https://management.local.azurestack.external"><pre class="notranslate"><code class="notranslate">[default]
ad_user=username@azurestack-domain
password=xxxxxxxxxxx
subscription_id=&lt;subscription id&gt;
cloud_environment=https://management.local.azurestack.external
</code></pre></div>
<p dir="auto">Once in place the playbook defined can be run with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook -i localhost /root/.azure/test.yaml -vvv"><pre class="notranslate"><code class="notranslate">ansible-playbook -i localhost /root/.azure/test.yaml -vvv
</code></pre></div>

<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---
- hosts: localhost
  tasks:
  - name: Create a resource group
    azure_rm_resourcegroup:
      name: Testing
      location: local
  - name: Create storage account
    azure_rm_storageaccount:
      resource_group: Testing
      name: testaccount001
      account_type: Standard_LRS
  - name: Create virtual network
    azure_rm_virtualnetwork:
      resource_group: Testing
      name: testvn001
      address_prefixes: &quot;10.10.0.0/16&quot;
  - name: Add subnet
    azure_rm_subnet:
      resource_group: Testing
      name: subnet001
      address_prefix: &quot;10.10.0.0/24&quot;
      virtual_network: testvn001
  - name: Create public ip
    azure_rm_publicipaddress:
      resource_group: Testing
      allocation_method: Static
      name: publicip001
  - name: Create security group that allows SSH
    azure_rm_securitygroup:
      resource_group: Testing
      name: secgroup001
      rules:
      - name: SSH
        source_address_prefix: '*'
        protocol: Tcp
        destination_port_range: 22
        access: Allow
        priority: 101
        direction: Inbound
  - name: Create NIC
    azure_rm_networkinterface:
      resource_group: Testing
      name: testnic001
      virtual_network: testvn001
      subnet: subnet001
      public_ip_name: publicip001
      security_group: secgroup001
  - name: Create virtual machine
    azure_rm_virtualmachine:
      resource_group: Testing
      name: testvm001
      state: absent
  - name: Create virtual machine
    azure_rm_virtualmachine:
      resource_group: Testing
      name: testvm001
      vm_size: Standard_D1
      storage_account: testaccount001
      storage_container: testvm001
      storage_blob: testvm001.vhd
      admin_username: admin
      admin_password: Password!
      network_interfaces: testnic001
      image:
        offer: UbuntuServer
        publisher: Canonical
        sku: '16.04-LTS'
        version: latest"><pre class="notranslate">---
- <span class="pl-ent">hosts</span>: <span class="pl-s">localhost</span>
  <span class="pl-ent">tasks</span>:
  - <span class="pl-ent">name</span>: <span class="pl-s">Create a resource group</span>
    <span class="pl-ent">azure_rm_resourcegroup</span>:
      <span class="pl-ent">name</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">location</span>: <span class="pl-s">local</span>
  - <span class="pl-ent">name</span>: <span class="pl-s">Create storage account</span>
    <span class="pl-ent">azure_rm_storageaccount</span>:
      <span class="pl-ent">resource_group</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">name</span>: <span class="pl-s">testaccount001</span>
      <span class="pl-ent">account_type</span>: <span class="pl-s">Standard_LRS</span>
  - <span class="pl-ent">name</span>: <span class="pl-s">Create virtual network</span>
    <span class="pl-ent">azure_rm_virtualnetwork</span>:
      <span class="pl-ent">resource_group</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">name</span>: <span class="pl-s">testvn001</span>
      <span class="pl-ent">address_prefixes</span>: <span class="pl-s"><span class="pl-pds">"</span>10.10.0.0/16<span class="pl-pds">"</span></span>
  - <span class="pl-ent">name</span>: <span class="pl-s">Add subnet</span>
    <span class="pl-ent">azure_rm_subnet</span>:
      <span class="pl-ent">resource_group</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">name</span>: <span class="pl-s">subnet001</span>
      <span class="pl-ent">address_prefix</span>: <span class="pl-s"><span class="pl-pds">"</span>10.10.0.0/24<span class="pl-pds">"</span></span>
      <span class="pl-ent">virtual_network</span>: <span class="pl-s">testvn001</span>
  - <span class="pl-ent">name</span>: <span class="pl-s">Create public ip</span>
    <span class="pl-ent">azure_rm_publicipaddress</span>:
      <span class="pl-ent">resource_group</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">allocation_method</span>: <span class="pl-s">Static</span>
      <span class="pl-ent">name</span>: <span class="pl-s">publicip001</span>
  - <span class="pl-ent">name</span>: <span class="pl-s">Create security group that allows SSH</span>
    <span class="pl-ent">azure_rm_securitygroup</span>:
      <span class="pl-ent">resource_group</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">name</span>: <span class="pl-s">secgroup001</span>
      <span class="pl-ent">rules</span>:
      - <span class="pl-ent">name</span>: <span class="pl-s">SSH</span>
        <span class="pl-ent">source_address_prefix</span>: <span class="pl-s"><span class="pl-pds">'</span>*<span class="pl-pds">'</span></span>
        <span class="pl-ent">protocol</span>: <span class="pl-s">Tcp</span>
        <span class="pl-ent">destination_port_range</span>: <span class="pl-c1">22</span>
        <span class="pl-ent">access</span>: <span class="pl-s">Allow</span>
        <span class="pl-ent">priority</span>: <span class="pl-c1">101</span>
        <span class="pl-ent">direction</span>: <span class="pl-s">Inbound</span>
  - <span class="pl-ent">name</span>: <span class="pl-s">Create NIC</span>
    <span class="pl-ent">azure_rm_networkinterface</span>:
      <span class="pl-ent">resource_group</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">name</span>: <span class="pl-s">testnic001</span>
      <span class="pl-ent">virtual_network</span>: <span class="pl-s">testvn001</span>
      <span class="pl-ent">subnet</span>: <span class="pl-s">subnet001</span>
      <span class="pl-ent">public_ip_name</span>: <span class="pl-s">publicip001</span>
      <span class="pl-ent">security_group</span>: <span class="pl-s">secgroup001</span>
  - <span class="pl-ent">name</span>: <span class="pl-s">Create virtual machine</span>
    <span class="pl-ent">azure_rm_virtualmachine</span>:
      <span class="pl-ent">resource_group</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">name</span>: <span class="pl-s">testvm001</span>
      <span class="pl-ent">state</span>: <span class="pl-s">absent</span>
  - <span class="pl-ent">name</span>: <span class="pl-s">Create virtual machine</span>
    <span class="pl-ent">azure_rm_virtualmachine</span>:
      <span class="pl-ent">resource_group</span>: <span class="pl-s">Testing</span>
      <span class="pl-ent">name</span>: <span class="pl-s">testvm001</span>
      <span class="pl-ent">vm_size</span>: <span class="pl-s">Standard_D1</span>
      <span class="pl-ent">storage_account</span>: <span class="pl-s">testaccount001</span>
      <span class="pl-ent">storage_container</span>: <span class="pl-s">testvm001</span>
      <span class="pl-ent">storage_blob</span>: <span class="pl-s">testvm001.vhd</span>
      <span class="pl-ent">admin_username</span>: <span class="pl-s">admin</span>
      <span class="pl-ent">admin_password</span>: <span class="pl-s">Password!</span>
      <span class="pl-ent">network_interfaces</span>: <span class="pl-s">testnic001</span>
      <span class="pl-ent">image</span>:
        <span class="pl-ent">offer</span>: <span class="pl-s">UbuntuServer</span>
        <span class="pl-ent">publisher</span>: <span class="pl-s">Canonical</span>
        <span class="pl-ent">sku</span>: <span class="pl-s"><span class="pl-pds">'</span>16.04-LTS<span class="pl-pds">'</span></span>
        <span class="pl-ent">version</span>: <span class="pl-s">latest</span></pre></div>

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

<p dir="auto">I expect a VM to be created.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">VM fails to create because managed disks is not supported on Azure Stack. Really this needs to be resolved by supporting API versions properly and this is likely to be resolved here <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="239249615" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/26195" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/26195/hovercard" href="https://github.com/ansible/ansible/issues/26195">#26195</a>. <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/lmazuel/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/lmazuel">@lmazuel</a> and <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/tstringer/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/tstringer">@tstringer</a> I am tagging you on this as you guys seem to be working on solving these challenges :)</p>
<p dir="auto">We can hack a fix in for this by running:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sed -i '1032s/managed_disk_type = data_disk['managedDisk']['storageAccountType']/#managed_disk_type = data_disk['managedDisk']['storageAccountType']/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i 's/managed_disk=managed_disk,/#managed_disk=managed_disk,/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i 's/managed_disk=data_disk_managed_disk,/#managed_disk=data_disk_managed_disk,/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i 's/self.delete_managed_disks(managed_disk_ids)/#self.delete_managed_disks(managed_disk_ids)/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i -e '1193,1195d' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i -e 's/elif(vm.storage_profile.os_disk.vhd):/if(vm.storage_profile.os_disk.vhd):/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py"><pre class="notranslate"><code class="notranslate">sed -i '1032s/managed_disk_type = data_disk['managedDisk']['storageAccountType']/#managed_disk_type = data_disk['managedDisk']['storageAccountType']/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i 's/managed_disk=managed_disk,/#managed_disk=managed_disk,/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i 's/managed_disk=data_disk_managed_disk,/#managed_disk=data_disk_managed_disk,/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i 's/self.delete_managed_disks(managed_disk_ids)/#self.delete_managed_disks(managed_disk_ids)/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i -e '1193,1195d' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
sed -i -e 's/elif(vm.storage_profile.os_disk.vhd):/if(vm.storage_profile.os_disk.vhd):/g' /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
</code></pre></div>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [Create virtual machine] ***********************************************************************************************************************************************************************************************************************************************
task path: /root/.azure/test.yaml:59
Using module file /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
&lt;127.0.0.1&gt; ESTABLISH LOCAL CONNECTION FOR USER: root
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'echo ~ &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p &quot;` echo /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842 `&quot; &amp;&amp; echo ansible-tmp-1513336142.73-200392836720842=&quot;` echo /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842 `&quot; ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /tmp/tmpouWOvA TO /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/azure_rm_virtualmachine.py
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/ /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/azure_rm_virtualmachine.py &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/azure_rm_virtualmachine.py; rm -rf &quot;/root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
The full traceback is:
Traceback (most recent call last):
  File &quot;/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py&quot;, line 1551, in &lt;module&gt;
    main()
  File &quot;/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py&quot;, line 1548, in main
    AzureRMVirtualMachine()
  File &quot;/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py&quot;, line 651, in __init__
    supports_check_mode=True)
  File &quot;/tmp/ansible_cOJ_1h/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py&quot;, line 285, in __init__
  File &quot;/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py&quot;, line 867, in exec_module
    caching=self.os_disk_caching,
TypeError: __init__() got an unexpected keyword argument 'managed_disk'

fatal: [localhost]: FAILED! =&gt; {
    &quot;changed&quot;: false,
    &quot;module_stderr&quot;: &quot;Traceback (most recent call last):\n  File \&quot;/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py\&quot;, line 1551, in &lt;module&gt;\n    main()\n  File \&quot;/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py\&quot;, line 1548, in main\n    AzureRMVirtualMachine()\n  File \&quot;/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py\&quot;, line 651, in __init__\n    supports_check_mode=True)\n  File \&quot;/tmp/ansible_cOJ_1h/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\&quot;, line 285, in __init__\n  File \&quot;/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py\&quot;, line 867, in exec_module\n    caching=self.os_disk_caching,\nTypeError: __init__() got an unexpected keyword argument 'managed_disk'\n&quot;,
    &quot;module_stdout&quot;: &quot;&quot;,
    &quot;msg&quot;: &quot;MODULE FAILURE&quot;,
    &quot;rc&quot;: 0
}"><pre class="notranslate"><code class="notranslate">TASK [Create virtual machine] ***********************************************************************************************************************************************************************************************************************************************
task path: /root/.azure/test.yaml:59
Using module file /usr/lib/python2.7/site-packages/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
&lt;127.0.0.1&gt; ESTABLISH LOCAL CONNECTION FOR USER: root
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'echo ~ &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842 `" &amp;&amp; echo ansible-tmp-1513336142.73-200392836720842="` echo /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842 `" ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /tmp/tmpouWOvA TO /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/azure_rm_virtualmachine.py
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/ /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/azure_rm_virtualmachine.py &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/azure_rm_virtualmachine.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1513336142.73-200392836720842/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py", line 1551, in &lt;module&gt;
    main()
  File "/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py", line 1548, in main
    AzureRMVirtualMachine()
  File "/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py", line 651, in __init__
    supports_check_mode=True)
  File "/tmp/ansible_cOJ_1h/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py", line 285, in __init__
  File "/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py", line 867, in exec_module
    caching=self.os_disk_caching,
TypeError: __init__() got an unexpected keyword argument 'managed_disk'

fatal: [localhost]: FAILED! =&gt; {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py\", line 1551, in &lt;module&gt;\n    main()\n  File \"/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py\", line 1548, in main\n    AzureRMVirtualMachine()\n  File \"/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py\", line 651, in __init__\n    supports_check_mode=True)\n  File \"/tmp/ansible_cOJ_1h/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\", line 285, in __init__\n  File \"/tmp/ansible_cOJ_1h/ansible_module_azure_rm_virtualmachine.py\", line 867, in exec_module\n    caching=self.os_disk_caching,\nTypeError: __init__() got an unexpected keyword argument 'managed_disk'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 0
}
</code></pre></div>