0

I try to deploy some container to proxmox via ansible+hookscript with proxmoxer.

I follow the documentation to install both proxmoxer and requests on controller (workstation) and node (proxmox)

First of all i tried to reach the proxmox api with root@pam:

curl -k -d 'username=root@pam' --data-urlencode 'password=MYPASSWORD https://192.168.10.30:8006/api2/json/access/ticket

it works :

pvedaemon[425432]: <root@pam> successful auth for user 'root@pam 

Then i edited a simple hosts file as follows :

[perseverance]
192.168.10.30
[perseverance:vars]
ansible_user=root
ansible_ssh_private_key_file=/home/spino/.ssh/mars.lab
ansible_ssh_common_args='-o IdentitiesOnly=yes'

i prepared a simple playbook:

---
- hosts: perseverance
  gather_facts: false
  tasks:
    - name: "Create logz container with hookscript and description"
      community.general.proxmox:
        vmid: 151
        node: perseverance
        api_user: root@pam
        api_password: "{{ vault_root_passwd }}"
        api_host: perseverance
        password: "{{ vault_root_passwd }}"
        hostname: logz.planet.mars
        ostemplate: 'local:vztmpl/debian-11-standard_11.6-1_amd64.tar.zst'
        hookscript: 'local:snippets/logz.sh'
        description: created with ansible

I edited a vault for the root password and start with this:

ansible-playbook -i hosts -e "@vault" playbooks/deploy_logz.yml

I got this error:

TASK [Create logz container with hookscript and description] *********************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='perseverance', port=8006): Max retries exceeded with url: /api2/json/access/ticket (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f1e8f305dc0>, 'Connection to perseverance timed out. (connect timeout=5)'))
fatal: [192.168.10.30]: FAILED! => {"changed": false, "msg": "HTTPSConnectionPool(host='perseverance', port=8006): Max retries exceeded with url: /api2/json/access/ticket (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f1e8f305dc0>, 'Connection to perseverance timed out. (connect timeout=5)'))"}

PLAY RECAP ***********************************************************************************************************************************************************************************
192.168.10.30              : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0 

I'm a little puzzled why it doesn't work I'm 100% sure i miss something here.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
proxyd43
  • 152
  • 1
  • 2
  • 12

0 Answers0