-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.0.1-rc1] docs out of date #932
Comments
cloud-init
docs out of date
In here, where Resource/proxmox_cloud_init_disk is documented in example box there is resource proxmox_vm_qemu with setup
which is not actual setup. Guides/cloud_init looks also bit strange |
Making a note for cloud init and new disk format to work in case anyone was wondering because fixes are super scattered among multiple posts right now.
Note i use vars as i have prompting shell script to make vms, albeit not perfect, but my typical dev deployments it's fine. Appreciate the hard work everyone does on this project, but docs need to be updated on a per feature basis, not after. No one wants to dig through source with trial and error that is not a good practice. |
@jjblack604 thanks for snippet. So I just wanna ask because it's still not obvious for me, assuming i Have cloud-init template in YAML format, how does one use it using current version of this provider, epsecially together with options such as ciuser = "ci-user"
cipassword = "password" |
This setup doesn't work either. Where do you have |
S
Shoot sorry I had copied the wrong template, see the post above again of mine I edited it. @electropolis Please note that some of these options are custom configs for me of coruse, but the bulk is there, I use vars pulled from vars.tf for a few items of course. |
Mine looks almost the same but the whole structure is the same and still doesn't work. It eliminates cloudinit ide2 CD-ROM and add blank one on Proxmox 8.1.3
Im using cicustom based on snippets with cloudinit yaml files. |
hmmm, i'm actually now using 8.1.4 not sure if that plays into anything, but also not using cicustom bit you have my cloud-init drive is adding as ide3, there is blank 'cd-rom' as ide2, which is where cloud-init use to be for me |
currently not using this myself, will have to take a look, i have some things set on my cloneable templates. |
@jjblack604 And how's your template looks like? Because that's the start point of this. Mine is with ide2 cloudinit drive |
vars.tf:
main.tf
|
Third post down has an example and that seems to work if I were to implement it, it looks like you would use the cicustom option to pass a config, but this I don't use myself, looks like @electropolis does use it though. Package management I use ansible to manage vm installs after being spun up. Terraform to deploy, Ansible to manage. |
So no way to do this using inline methods?
|
hmm yeah, again not sure as I don't use it, i essentially just sshkeys to inject a single key, then ansible to add multiple users and ssh keys afterwards, maybe someone else can chime in with an example if they use the way you do |
I also find it odd that we are force attaching a cdrom disk to ide2 with no way to disable that option? It's fine that cloud-init now uses ide3 instead of previous ide2 but can we have a flag available to disable this? It's fine if it is default true just no need for it. |
I was asking about the template which you are using to clone. I have that process in ansible set with qm commands with cloudinit disk |
Ah you mean the images? I have a few images set up to be cloned from. What would you like to know about them? I think I had built them off: https://austinsnerdythings.com/2021/08/30/how-to-create-a-proxmox-ubuntu-cloud-init-image/ |
Details of those template. Do they have cloudinit
|
In the sense that the templates that can be cloned, do they have cloud-init setup, yes with basic configuration, and I have customized the images somewhat to have some admin type settings applied but I do not actively modify those templated images as the overhead for that is too high. |
Ok so this is the case. Can you show the exact detail of the template from hardware how you have the cloudinit drive set up? Because mine looks like this Which is the standard scenario when preparing a template with cloudinit on ide2. And those templates don't work. Every time during terraform provisioning process the cloudinit disappear and ide2 has taken by cd-rom without any source. That's why I'm asking of you have a proper configuration then please share it so that everyone can use because this all about retrieving finally working configuration. This version of provider as we already know has some issues with that ide2. And I don't know finally what to do but for sure the current setup which I had when working on proxmox 7 isn't working on 8.1.3 so what modification has been made by you? What changes when comparing to the standard configuration? Because it's not about the terraform code as we both show. |
I tried to get my head around all the info and I was not able to solve my need to write a cloud init and pass it via terraform to proxmox to spin up a cloned vm. Some help would be much appreciated. |
ide2 is reserved now for cd rom, ide3 will be for the cloud-init image according to the docs in the repo (Only for the terraform side, not for the cloneable vms) Their basic cloud-init config: and an image i spun up using terraform: see ide3 above? if you're still getting ide2 vanishing it means your configuration is wrong if you're using release candidate 3.0.1-rc1. you either have a config that is extra or have not added with cloudinit_cdrom_storage it means cloud-int will provision to ide3 in the source:
can you paste a template of yours again a fresh one you are using? |
Template , screen, I already showed you. You asking for tf code, that one I showed also but let me paste it again
I do have everything setup nicely because it worked earlier. The problem is that that cloudinit disappears so if my config is wrong what is the new one? Because yours is the same that works also on PVE7. So what changed because I don't see a thing. And just to be clear. Ide2 doesn't vanish for good. I Get vanishing cloudinit ide2 from the template when the virtual machine spins up. It is provisioned and in that step it has cloudinit on ide2 like in the template. But suddenly ide2 changes to none,cdrom but ide3 with cloud-init doesn't appear. And that case is described here: #901 |
Hmm you do have a ton of structural differences in your template in terms of how you provision compared to mine and truthfully it is far too difficult to know exactly what is causing it because of that. I am also running 8.1.4 and you are at 8.1.3, maybe that's the difference? I don't think I'm going to be much help trying to fix your template, you're likely going to have to start removing features until you find a point that works so you can isolate the issue. I don't rely on calling file configs like you do within the template for cloud-init, I would start there. It may have worked before, but there are definite syntax changes in 3.0.1-rc1 and you're going to have to go through the source to see what they are and how that impacts not only your terraform templates, but all your cloud-init file imports. |
Hi @jjblack604 , I reviewed a lot of issues now and didn’t find an end to end example yet. And I seems the documentation is outdated right now. Would it be possible that you provide and end to end example how you set up a VM? Starting from how you generate a VM template (bash script or step by step with qm create and qm set steps), terraform code with how you create the cloud-init part, and maybe how you add additional software to the created VM. Are you using ansible? From my point of view the screenshots don’t help that much, as they only show the result. Not the input which successfully created the result. I have tested a lot. The only way I was able to get the terraform provider successfully clone and spine up a template is by adding a hard coded cloud init script to initial VM template. But then I have all VMs with the same users and the sam w software. ciuser and sshkeys is no longer processed in the terraform code. let me know when it would be beneficial to post all my steps in detail. I would be very happy to help improve the docs so that we have the working examples end to end documented in one place and not spread across issues and discord. Thank you again for all your patience and help. |
But that ton is irrelevant. Just focus on the resource of |
My Point is, I'm saying remove everything that does not match my templates for now for testing purposes only, I am trying to help you isolate where the issue is. My templates work and yours do not, so there is a possibility those extra pieces are causing issues. Aside from that I see:
terraform {
|
I had used these two guides initially: So full credit to the author Austin there.
While it is possible to add custom packages and extra ssh keys etc with Terraform, I personally opt to use Ansible for this. So I also have a single user configured with SSH via terraform - which is my user since I only use proxmox for deving. Then I have several dozen ansible roles I use to manage things like server configuration, users, other things depending on what the VM or server is going to be doing. I am not a contributor to this project, just a user like yourself. It sounds like you are on the right track, if you were opting to use ansible you could configure extra users and install packages after initial terraform setup. While I don't have the time to create a guide at the moment, found this quick vid about deploying ssh keys with ansible if you are unfamiliar. There would also be lots of content available out there for things like packages etc. |
Because best practice is to use loops instead count that makes by default your resources added to the list with changeable index. If you have for example 3 servers so they received index 0,1,2. When you remove the second server that has 1 the one with index 2 will be removed and created again so that it will take the free index 1. That's why count is basically avoided and only used in specific scenarios. So yes, I do have that in tfvars file
I can try to disable those other things but basically it will crash my script and I Will have to set different variables. I will try first of all to remove cloudinit disk from template , by preparing a new one. In other issue here some guy says he has no cloudinit attached to a template at all. He is attaching it when cloning using terraform. btw
And it's good to have all the VMs with the same initial user and software, basic, additional one. And rest can be used by ansible. Cloudinit Is the pre-configuration step that provides among above things for example a dedicated user of ansible with key that can be used after the installation with ansible as a post-configuration setup. |
@jjblack604 it would be quicker if you could change the code use cicustom by manually adding cloudinit snippets. I'm trying to do it with different steps
In all cases I received only CD-ROM. :/ btw I checked proxmox version and I use 8.1.4
if the debug will get your attention but I'm worry about those invalid plan for proxmox that is seen in the log Screen.Recording.2024-02-12.at.13.53.12.movHere is the clip that shows exactly the behaviour I was working based on this tutorial: https://yetiops.net/posts/proxmox-terraform-cloudinit-saltstack-prometheus/#creating-a-template I've just added additional config for network in the |
I don't do the above, terraform should download the correct version when it applies the config if it is stated in main.tf. I also install the qemu-guest-agent PRIOR, into my images Cloud init drive is supposed to be on IDE3 now. NOT IDE2 as I posted above, it is in the source code for 3.0.1-rc1 as a change. https://drive.google.com/file/d/1xOCIgTY-RMXOrqSESbE9mgtrNm-BiAis/view?usp=drive_link
I will not be attempting to re-create and fix your code. The reference to #922 looks like it was addressed by installing the qemu agent? I install this into my custom images, BEFORE cloud-init: https://austinsnerdythings.com/2021/08/30/how-to-create-a-proxmox-ubuntu-cloud-init-image/ I don't have more time to spend on this. I hope you are able to resolve the issue. I have provided a working configuration example and all links for how I have setup my cloneable vms are in the posts above as well as video proof of it working. |
And this is why I use cloudinit. I don't do any template modification after creation, I don't run any additional scripts that probably are doing the same what I'm doing with cloudinit. Template is prepared by ansible scripts like that, according to the official proxmox documentation for cloudinit. The Ansible code here So basically
That's a workaround without using snippets. So it's not a working configuration. It's a workaround. Working configuration is the configuration that doesn't prevent cloudinit that was previously created from disappearing leaving the newly created VM with cloudinit that was used set here I don't know why you are referring to the agent constantly. I don't have problem with agent. As soon as the cloudinit will work I will have agent. Creating Templates tutorials are all the same. Austin is using deprecated methods for pve7. I'm using those according to Official Proxmox Documentation. But that's irrelevant. That gives the same result. When it comes to terraform you don't use I just forgot where should the but the snippets can only be on So I don't remember which disk should be. You guys have the same because you are not using snippets. |
Back to the topic of original post, I see that Merge request has been submitted and I believe that should address the concerns this issue was created to address. |
The boot order is already set when creating the template |
The docs and examples of the
cloud-init
disk are out of date.Also check that the new
disks
is used in examples.The text was updated successfully, but these errors were encountered: