--- - name: provision containers hosts: 127.0.0.1 connection: local gather_facts: no vars: proxmox_host: "hyper01" tasks: - name: create containers proxmox: api_user: root@pam api_password: "{{ lookup('passwordstore', 'server/{{ proxmox_host }}') }}" api_host: "{{ hostvars[proxmox_host]['ip'] }}" node: "{{ proxmox_host }}" hostname: "{{ item }}" onboot: yes cpus: "{{ hostvars[item]['cpus'] }}" disk: "{{ hostvars[item]['disk'] }}" memory: "{{ hostvars[item]['memory'] }}" storage: 'local-zfs' ostemplate: "{{ hostvars[item]['ostemplate'] }}" password: "{{ lookup('passwordstore', 'container/{{ item }}/root') }}" pubkey: "{{ lookup('ansible.builtin.file', 'files/authorized_keys') }}" netif: "{{ hostvars[item]['net'] }}" unprivileged: yes features: - nesting=1 with_items: "{{ groups['container'] }}" - name: start containers proxmox: api_user: root@pam api_password: "{{ lookup('passwordstore', 'server/{{ proxmox_host }}') }}" api_host: "{{ hostvars[proxmox_host]['ip'] }}" node: "{{ proxmox_host }}" hostname: "{{ item }}" state: started with_items: "{{ groups['container'] }}"