So its 2024...
and im trying to create a vm thru ansibleplaybooks.
I'm looking for some what simple and "dumb" code that creates an VM from a template....
And btw how does ansible playbooks work with vmids? do i have to edit the playbook everytime i run it with a new vmid?
this code is the closest ive come sofar..
Im running this code and getting the return:
[Edit]
solution was change the structor,
Im currently using something simular to this
https://www.reddit.com/r/ansible/comments/12bbynr/proxmox_ansible_and_vm_templates/
and im trying to create a vm thru ansibleplaybooks.
I'm looking for some what simple and "dumb" code that creates an VM from a template....
And btw how does ansible playbooks work with vmids? do i have to edit the playbook everytime i run it with a new vmid?
this code is the closest ive come sofar..
YAML:
---
- name: Create Virtual Machine
tasks:
- proxmox_kvm:
api_host: 192.168.100.100
api_user: root@pam
api_token_id: TOKEN ID
api_token_secret: TOKEN SECRET
name: mc-serv
node: pve6
newid: 800
clone: MC-server
storage: VM-Storage
state: present
Im running this code and getting the return:
Code:
[user]: ansible-playbook test4.yaml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! 'community.general.proxmox_kvm' is not a valid attribute for a Play
The error appears to be in '/home/admin/vm/test4.yaml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: Create Virtual Machine
^ here
[Edit]
solution was change the structor,
Im currently using something simular to this
https://www.reddit.com/r/ansible/comments/12bbynr/proxmox_ansible_and_vm_templates/
Last edited: