-
🌀 @bc6Hi,
I am not sure what I am doing wrong here. I will try and troubleshoot but thought you may have seen this before.
I created
group_vars/all,templates/pve_create_vm/preseed.cfg.j2, andpve_create_vm.ymlto run your gist.Invocation:
ansible-playbook pve_create_vm.yml -e "pve_node=myloe pve_guest=testguest" --diffYou can see my full tree here:
. ├── ansible.cfg ├── contrib │ ├── kickstart │ │ └── server.ks │ └── preseed │ ├── late-command.sh │ ├── README.md │ └── server.seed ├── group_vars │ └── all ├── infra ├── pve_create_vm.yml ├── README.md ├── run.yml ├── templates │ ├── deploy-args-centos.j2 │ ├── deploy-args-ubuntu.j2 │ ├── kernel.j2 │ └── pve_create_vm │ └── preseed.cfg.j2 └── vars ├── vars.vm.yml ├── vars.yml └── vault.yml``` The Error:ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/srv/devops/ansible/create_vm/pve_create_vm.yml': line 82, column 7, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: "Create VM {{ pve_guest }}" ^ hereWe could be wrong, but this one looks like it might be an issue with missing quotes. Always quote template expression brackets when they start a value. For instance:
with_items: - {{ foo }}Should be written as:
with_items: - "{{ foo }}"The error appears to have been in '/srv/devops/ansible/create_vm/pve_create_vm.yml': line 82, column 7, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: "Create VM {{ pve_guest }}" ^ hereWe could be wrong, but this one looks like it might be an issue with missing quotes. Always quote template expression brackets when they start a value. For instance:
with_items: - {{ foo }}Should be written as:
with_items: - "{{ foo }}" -
🌀 @bc6I just realized that my new PVE host was running
2.2.1.0-2+deb9u1. I have added theppaand am now onansible 2.7.9.[WARNING]: Could not match supplied host pattern, ignoring: myloemyloeis my hostname/nodename -
🌀 @bc6Thank you for this!
-
Since this wasn't merged into the original project would you mind to fork the project and merge it yourself? I am happy to contribute since this is a nice and clean approach to launch VMs.
IP configuration should be possible via preseed file?
I am currently wonderring how to update VM settings like CPU, RAM and STORAGE of a VM based on group or host vars. Also wouldn't it make more sense to use cloud-init base images by now? They come ready to start and cloning the base images into a new virtual disk. One could even remove the cloud-init disk in PVE once initial deployment has finished.
Edited by Danilo S -
Thanks for your feedback, @DerDanilo. I fear that I lack the time to further work on this at the moment. The snippet was meant as an example. Feel free to do whatever you want with it
🙂 -
Thanks for this snippet. Helped a lot.
One thing I found is that for newer Debians, the initrd.gz can be a concatenated set of gzipped cpio files (same mechanism used for easily adding non-free firmware and drivers). This means that instead of unpacking and repacking the initrd, you can jut prepare your additions and cat the files together.
Also, you can use the management host (localhost) to call the api instead of making these calls from the hypervisor. Can work either way. I do prefer to do it on the management host as then don't need proxmoxer python module on the hypervisor.
Please register or sign in to comment