[SOLVED] Ansible - Create LXC / Was ist da los ?

harry1983

Member
Feb 17, 2022
84
14
13
41
Grüss euch

Ich bräuchte mal wieder euer Schwarmwissen.
Hatte mich die letzten Tage mit Ansible-Semphore gespielt und versucht ein Create LXC Template zu bauen.

Leider funktioniert es einfach und nicht ich weiss grad nicht woran es liegt.

Was habe ich gemacht

  1. API Key für root User angelegt
  2. Ansible User mit Sudo Rechten am Host angelegt
  3. SSH Key vom Ansible Server am Host hinterlegt, SSH mit Key getestet , sudo getestet --> Passt alles
Folgendes Playbook hätte ich aktuell:

Code:
- hosts: proxmox
  become: true
  tasks:
    - name: Create container for PVE
      community.general.proxmox:
        node: "{{ proxmox_lxc_node }}"
        api_user: "{{ proxmox_api_user }}"
        api_token_id: "{{ proxmox_api_tokenid }}"
        api_token_secret: "{{ proxmox_api_tokensecret }}"
        api_host: "{{ proxmox_api_host }}"
        password: "{{ proxmox_lxc_password }}"
        hostname: "{{ proxmox_lxc_name }}"
        vmid: "{{ proxmox_lxc_vmid }}"
        cores: "{{ proxmox_lxc_cores }}"
        memory: "{{ proxmox_lxc_memory }}"
        swap: '512'
        storage: 'VMStorage'
        disk: "{{ proxmox_lxc_disk_size }}"
        unprivileged: yes
        description: LXC Small über Ansible
        ostemplate: 'local:vztmpl/ubuntu-23.04-standard_23.04-1_amd64.tar.zst'
        proxmox_default_behavior: no_defaults
        onboot: no
        netif: '{"net0":"name=eth0,gw=192.168.0.1,ip=dhcp,bridge=vmbr2"}'

Und folgenden Fehler bekomme ich aktuell:

Code:
msg": "Creation of lxc VM 314 failed with exception: 500 Internal Server Error: Only root can pass arbitrary filesystem paths. at /usr/share/perl5/PVE/Storage.pm line 543."

Was überseh ich bzw. wo hängts da? Laut Logfile übernimmt er alle Variablen brav in den Host.

Hat jemand eine Idee oder Vorschlag?

lg Harry
 
Hi,

Hast du überprüft, ob der API User api_user ausreichende Permissions hat, um die Operation durchzuführen?
 
LIegt es vielleicht am Pfad zu den Standard Images? Ich hab diesen aus einer anderen Vorlage entnommen, bei mir wären die Images unter Local im Standardordner.
 
Hab den Fehler gefunden, beim Definieren der disk muss man den Namen des Storage mit einem Doppelpunkt und danach die Grösse bekanntgeben, also zb. so:

Code:
 disk: 'VMStorage:8'

Dann funktioniert das Deployment
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!