<p dir="auto">Maybe related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="225224445" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/24139" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/24139/hovercard" href="https://github.com/ansible/ansible/issues/24139">#24139</a><br>
Different HTTP error code 500</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">contrib/inventory/proxmox.py</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">ansible 2.3.0.0<br>
config file = /etc/ansible/ansible.cfg<br>
configured module search path = [u'/usr/lib/python2.7/site-packages/ansible/modules/extras', u'/usr/lib/python2.7/site-packages/ansible/modules/core']<br>
python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">nothing special</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">CentOS 7.3</p>
<h5 dir="auto">SUMMARY</h5>
<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="---

- hosts: 127.0.0.1
  connection: local
  vars:
    - proxmox_user: ansible@pve
    - proxmox_password: badpasswd
    - proxmox_host: 1.2.3.4
  tasks:
  - proxmox:
     state: present
#     vmid: 103
#     validate_certs: no
     node: 'pve'
     api_user: &quot;{{ proxmox_user }}&quot;
     api_password: &quot;{{ proxmox_password }}&quot;
     api_host: &quot;{{ proxmox_host }}&quot;
#     disk: 8
     storage: 'pve-storage'
#     memory: 512
#     swap: 512
     password: evenbetterpasswd
     hostname: lxctest
     ostemplate: 'pve-templates:vztmpl/centos-7-default_20160205_amd64.tar.xz'
#     netif: '{&quot;net0&quot;:&quot;name=eth0,ip=dhcp,ip6=dhcp,bridge=vmbr0,tag=2&quot;}'"><pre class="notranslate">---

- <span class="pl-ent">hosts</span>: <span class="pl-s">127.0.0.1</span>
  <span class="pl-ent">connection</span>: <span class="pl-s">local</span>
  <span class="pl-ent">vars</span>:
    - <span class="pl-ent">proxmox_user</span>: <span class="pl-s">ansible@pve</span>
    - <span class="pl-ent">proxmox_password</span>: <span class="pl-s">badpasswd</span>
    - <span class="pl-ent">proxmox_host</span>: <span class="pl-s">1.2.3.4</span>
  <span class="pl-ent">tasks</span>:
  - <span class="pl-ent">proxmox</span>:
     <span class="pl-ent">state</span>: <span class="pl-s">present</span>
<span class="pl-c"><span class="pl-c">#</span>     vmid: 103</span>
<span class="pl-c"><span class="pl-c">#</span>     validate_certs: no</span>
     <span class="pl-ent">node</span>: <span class="pl-s"><span class="pl-pds">'</span>pve<span class="pl-pds">'</span></span>
     <span class="pl-ent">api_user</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ proxmox_user }}<span class="pl-pds">"</span></span>
     <span class="pl-ent">api_password</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ proxmox_password }}<span class="pl-pds">"</span></span>
     <span class="pl-ent">api_host</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ proxmox_host }}<span class="pl-pds">"</span></span>
<span class="pl-c"><span class="pl-c">#</span>     disk: 8</span>
     <span class="pl-ent">storage</span>: <span class="pl-s"><span class="pl-pds">'</span>pve-storage<span class="pl-pds">'</span></span>
<span class="pl-c"><span class="pl-c">#</span>     memory: 512</span>
<span class="pl-c"><span class="pl-c">#</span>     swap: 512</span>
     <span class="pl-ent">password</span>: <span class="pl-s">evenbetterpasswd</span>
     <span class="pl-ent">hostname</span>: <span class="pl-s">lxctest</span>
     <span class="pl-ent">ostemplate</span>: <span class="pl-s"><span class="pl-pds">'</span>pve-templates:vztmpl/centos-7-default_20160205_amd64.tar.xz<span class="pl-pds">'</span></span>
<span class="pl-c"><span class="pl-c">#</span>     netif: '{"net0":"name=eth0,ip=dhcp,ip6=dhcp,bridge=vmbr0,tag=2"}'</span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">LXC container created</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="5.6.7.8 - - [28/May/2017:20:15:57 +0200] &quot;POST /api2/json/access/ticket HTTP/1.1&quot; 200 663
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] &quot;GET /api2/json/version HTTP/1.1&quot; 200 108
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] &quot;GET /api2/json/cluster/nextid HTTP/1.1&quot; 200 14
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] &quot;GET /api2/json/cluster/resources?type=vm HTTP/1.1&quot; 200 11
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] &quot;GET /api2/json/cluster/resources?type=vm HTTP/1.1&quot; 200 11
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] &quot;GET /api2/json/nodes HTTP/1.1&quot; 200 196
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] &quot;GET /api2/json/nodes/pve/storage/pve-templates/content HTTP/1.1&quot; 200 492
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] &quot;POST /api2/json/nodes/pve/lxc HTTP/1.1&quot; 500 13"><pre class="notranslate"><code class="notranslate">5.6.7.8 - - [28/May/2017:20:15:57 +0200] "POST /api2/json/access/ticket HTTP/1.1" 200 663
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] "GET /api2/json/version HTTP/1.1" 200 108
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] "GET /api2/json/cluster/nextid HTTP/1.1" 200 14
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] "GET /api2/json/cluster/resources?type=vm HTTP/1.1" 200 11
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] "GET /api2/json/cluster/resources?type=vm HTTP/1.1" 200 11
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] "GET /api2/json/nodes HTTP/1.1" 200 196
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] "GET /api2/json/nodes/pve/storage/pve-templates/content HTTP/1.1" 200 492
5.6.7.8 - ansible@pve [28/May/2017:20:15:57 +0200] "POST /api2/json/nodes/pve/lxc HTTP/1.1" 500 13
</code></pre></div>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fatal: [127.0.0.1]: FAILED! =&gt; {
    &quot;changed&quot;: false,
    &quot;failed&quot;: true,
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;api_host&quot;: &quot;192.168.1.10&quot;,
            &quot;api_password&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;,
            &quot;api_user&quot;: &quot;ansible@pve&quot;,
            &quot;cpus&quot;: 1,
            &quot;cpuunits&quot;: 1000,
            &quot;disk&quot;: &quot;3&quot;,
            &quot;force&quot;: false,
            &quot;hostname&quot;: &quot;lxctest&quot;,
            &quot;ip_address&quot;: null,
            &quot;memory&quot;: 512,
            &quot;mounts&quot;: null,
            &quot;nameserver&quot;: null,
            &quot;netif&quot;: null,
            &quot;node&quot;: &quot;pve&quot;,
            &quot;onboot&quot;: false,
            &quot;ostemplate&quot;: &quot;pve-templates:vztmpl/centos-7-default_20160205_amd64.tar.xz&quot;,
            &quot;password&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;,
            &quot;pool&quot;: null,
            &quot;pubkey&quot;: null,
            &quot;searchdomain&quot;: null,
            &quot;state&quot;: &quot;present&quot;,
            &quot;storage&quot;: &quot;pve-storage&quot;,
            &quot;swap&quot;: 0,
            &quot;timeout&quot;: 30,
            &quot;unprivileged&quot;: false,
            &quot;validate_certs&quot;: false,
            &quot;vmid&quot;: null
        }
    },
    &quot;msg&quot;: &quot;creation of lxc VM 103 failed with exception: 500 Internal Server Error&quot;
"><pre class="notranslate"><code class="notranslate">fatal: [127.0.0.1]: FAILED! =&gt; {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "api_host": "192.168.1.10",
            "api_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "api_user": "ansible@pve",
            "cpus": 1,
            "cpuunits": 1000,
            "disk": "3",
            "force": false,
            "hostname": "lxctest",
            "ip_address": null,
            "memory": 512,
            "mounts": null,
            "nameserver": null,
            "netif": null,
            "node": "pve",
            "onboot": false,
            "ostemplate": "pve-templates:vztmpl/centos-7-default_20160205_amd64.tar.xz",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "pool": null,
            "pubkey": null,
            "searchdomain": null,
            "state": "present",
            "storage": "pve-storage",
            "swap": 0,
            "timeout": 30,
            "unprivileged": false,
            "validate_certs": false,
            "vmid": null
        }
    },
    "msg": "creation of lxc VM 103 failed with exception: 500 Internal Server Error"

</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">contrib/inventory/proxmox.py</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.0.0
  config file = .../moon-ansible.windows/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]"><pre class="notranslate"><code class="notranslate">ansible 2.3.0.0
  config file = .../moon-ansible.windows/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
inventory = ./inventory"><pre class="notranslate"><code class="notranslate">[defaults]
inventory = ./inventory
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<h5 dir="auto">SUMMARY</h5>

<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">All you see is either a 500 Forbidden or a 400 Bad request error. No follow up errors why it happens.</p>

<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---
- name: create prox serves
  hosts: 127.0.0.1
  connection: local
  gather_facts: false

  tasks:
     - proxmox:
        node: 'pve2'
        api_user: 'xxx'
        api_password: 'xxx'
        api_host: '127.0.0.1'
        ostemplate: 'data:vztmpl/debian-8.0-standard_8.6-1_amd64.tar.gz'
        pubkey: '...'
"><pre class="notranslate">---
- <span class="pl-ent">name</span>: <span class="pl-s">create prox serves</span>
  <span class="pl-ent">hosts</span>: <span class="pl-s">127.0.0.1</span>
  <span class="pl-ent">connection</span>: <span class="pl-s">local</span>
  <span class="pl-ent">gather_facts</span>: <span class="pl-c1">false</span>

  <span class="pl-ent">tasks</span>:
     - <span class="pl-ent">proxmox</span>:
        <span class="pl-ent">node</span>: <span class="pl-s"><span class="pl-pds">'</span>pve2<span class="pl-pds">'</span></span>
        <span class="pl-ent">api_user</span>: <span class="pl-s"><span class="pl-pds">'</span>xxx<span class="pl-pds">'</span></span>
        <span class="pl-ent">api_password</span>: <span class="pl-s"><span class="pl-pds">'</span>xxx<span class="pl-pds">'</span></span>
        <span class="pl-ent">api_host</span>: <span class="pl-s"><span class="pl-pds">'</span>127.0.0.1<span class="pl-pds">'</span></span>
        <span class="pl-ent">ostemplate</span>: <span class="pl-s"><span class="pl-pds">'</span>data:vztmpl/debian-8.0-standard_8.6-1_amd64.tar.gz<span class="pl-pds">'</span></span>
        <span class="pl-ent">pubkey</span>: <span class="pl-s"><span class="pl-pds">'</span>...<span class="pl-pds">'</span></span>
</pre></div>

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

<p dir="auto">A VM or Container to be created.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">`</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fatal: [127.0.0.1]: FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;api_host&quot;: &quot;xxx&quot;, 
            &quot;api_password&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;, 
            &quot;api_user&quot;: &quot;xxx@pve&quot;, 
            &quot;cpus&quot;: 1, 
            &quot;cpuunits&quot;: 1000, 
            &quot;disk&quot;: &quot;3&quot;, 
            &quot;force&quot;: false, 
            &quot;hostname&quot;: null, 
            &quot;ip_address&quot;: null, 
            &quot;memory&quot;: 512, 
            &quot;mounts&quot;: null, 
            &quot;nameserver&quot;: null, 
            &quot;netif&quot;: {
                &quot;node0&quot;: &quot;gw=xxx,bridge=vmbr1,name=eth0,ip=xxx/25&quot;
            }, 
            &quot;node&quot;: &quot;pve2&quot;, 
            &quot;onboot&quot;: false, 
            &quot;ostemplate&quot;: &quot;data:vztmpl/debian-8.0-standard_8.6-1_amd64.tar.gz&quot;, 
            &quot;password&quot;: null, 
            &quot;pool&quot;: null, 
            &quot;pubkey&quot;: &quot;...&quot;, 
            &quot;searchdomain&quot;: null, 
            &quot;state&quot;: &quot;present&quot;, 
            &quot;storage&quot;: &quot;local&quot;, 
            &quot;swap&quot;: 0, 
            &quot;timeout&quot;: 30, 
            &quot;unprivileged&quot;: false, 
            &quot;validate_certs&quot;: false, 
            &quot;vmid&quot;: null
        }
    }, 
    &quot;msg&quot;: &quot;creation of lxc VM 198 failed with exception: 400 Bad Request&quot;
}"><pre class="notranslate"><code class="notranslate">fatal: [127.0.0.1]: FAILED! =&gt; {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "api_host": "xxx", 
            "api_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "api_user": "xxx@pve", 
            "cpus": 1, 
            "cpuunits": 1000, 
            "disk": "3", 
            "force": false, 
            "hostname": null, 
            "ip_address": null, 
            "memory": 512, 
            "mounts": null, 
            "nameserver": null, 
            "netif": {
                "node0": "gw=xxx,bridge=vmbr1,name=eth0,ip=xxx/25"
            }, 
            "node": "pve2", 
            "onboot": false, 
            "ostemplate": "data:vztmpl/debian-8.0-standard_8.6-1_amd64.tar.gz", 
            "password": null, 
            "pool": null, 
            "pubkey": "...", 
            "searchdomain": null, 
            "state": "present", 
            "storage": "local", 
            "swap": 0, 
            "timeout": 30, 
            "unprivileged": false, 
            "validate_certs": false, 
            "vmid": null
        }
    }, 
    "msg": "creation of lxc VM 198 failed with exception: 400 Bad Request"
}
</code></pre></div>
<p dir="auto">You can't debug the proxmox api easily. No idea why it's throwing a bad request and the provider isn't helpful either.</p>