Issue 1:
Maybe related to #24139

Different HTTP error code 500

ISSUE TYPE

Bug Report

COMPONENT NAME

contrib/inventory/proxmox.py

ANSIBLE VERSION

ansible 2.3.0.0

config file = /etc/ansible/ansible.cfg

configured module search path = [u'/usr/lib/python2.7/site-packages/ansible/modules/extras', u'/usr/lib/python2.7/site-packages/ansible/modules/core']

python version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

CONFIGURATION

nothing special

OS / ENVIRONMENT

CentOS 7.3

SUMMARY

STEPS TO REPRODUCE

---

- 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: "{{ proxmox_user }}"
api_password: "{{ proxmox_password }}"
api_host: "{{ proxmox_host }}"
# 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: '{"net0":"name=eth0,ip=dhcp,ip6=dhcp,bridge=vmbr0,tag=2"}'

EXPECTED RESULTS

LXC container created

ACTUAL RESULTS

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

fatal: [127.0.0.1]: FAILED! => {
"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"

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

contrib/inventory/proxmox.py

ANSIBLE VERSION

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]

CONFIGURATION

[defaults]
inventory = ./inventory

OS / ENVIRONMENT

SUMMARY

STEPS TO REPRODUCE

All you see is either a 500 Forbidden or a 400 Bad request error. No follow up errors why it happens.

---
- 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: '...'

EXPECTED RESULTS

A VM or Container to be created.

ACTUAL RESULTS

`

fatal: [127.0.0.1]: FAILED! => {
"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"
}

You can't debug the proxmox api easily. No idea why it's throwing a bad request and the provider isn't helpful either.