Proxmox virtual machine *automation* in Terraform

  Рет қаралды 91,974

Christian Lempa

Christian Lempa

Күн бұрын

Пікірлер: 92
@onetwofourfive
@onetwofourfive Жыл бұрын
“root user has all the privileges” - yes, therefore you should NOT use it in terraform and create another user with ALL NEEDED privileges, not all.
@JamesGreen-gv4yn
@JamesGreen-gv4yn 2 жыл бұрын
Thank you for the video, I have been looking for a way to do this as I have been using Proxmox in my home lab and love it! Learned Terraform for my work with AWS and really wanted a way to use it for my home lab as well. Note, that an even better approach for the credentials is to set environment variables `TF_VARS_proxmox_api_token_id` and `TF_VARS_proxmox_api_token_secret` and export them so Terraform picks them up. This way you don't have to worry about accidentally checking that file into a repository by mistake. You can also set them in your shell `rc` file (ie ~/bashrc) so they are always set. Options expand from there. This is what I will probably do.
@christianlempa
@christianlempa 2 жыл бұрын
Thank you! Great ideas to improve :)
@Pariah902
@Pariah902 2 жыл бұрын
FYI, you don't really need to set the vmid. If you don't the terraform provider will use the next available VM ID. This makes the terraform scripts a bit more flexible
@christianlempa
@christianlempa 2 жыл бұрын
Thanks! Yeah it will pick a random ID. However, I have an organized system there, that's why I defined it, but yes you're right ;)
@manedurphy
@manedurphy 2 жыл бұрын
This is for sure something that I want to implement on my proxmox cluster. Thanks for sharing!
@jerichoortega9659
@jerichoortega9659 10 ай бұрын
Excellent tutorial, thanks a lot ! Very well explained and you make it look so simple, good work !
@CrashLoopBackOff-K8s
@CrashLoopBackOff-K8s 2 жыл бұрын
Liked, subbed, and leaving a comment for the algorithm. Appreciate the content - great job.
@DarrolKHarris
@DarrolKHarris 2 жыл бұрын
You always great videos. You take complicated topics and make it understandable.
@christianlempa
@christianlempa 2 жыл бұрын
I appreciate that! Thank you so much
@chrisumali9841
@chrisumali9841 Жыл бұрын
thanks for the demo and info, have a great day
@christianlempa
@christianlempa Жыл бұрын
Thanks, you too!
@TheLocalStuff
@TheLocalStuff 10 ай бұрын
Thanks!
@christianlempa
@christianlempa 10 ай бұрын
Thank you so much for your support :)
@DietrichSchomberg
@DietrichSchomberg 2 жыл бұрын
It is 4:30 in the morning and just wanted relax and watch some videos … now i that have seen yours and i wanted to get up and try it out. VERY NICE WORK to get me out of my warm and cosy bed 🎉😂 need to remember watching cat videos next time
@christianlempa
@christianlempa 2 жыл бұрын
Haha thank you ;) Glad you enjoyed the video so much you even skipped the cat videos
@DietrichSchomberg
@DietrichSchomberg 2 жыл бұрын
@@christianlempa 😂😂😂👍 dein Video war interessanter als gedacht. Scriptbasiert eine Test Umgebung aufzusetzen steht schon lange auf meiner Liste. Was ich bisher gemacht/versucht habe mit vagrant und virtual Box war nicht sehr stabil😔
@Spydaw
@Spydaw 2 жыл бұрын
Whooo, this is awesome. Thank you for this video, good job ;) I am also using Packer and Terraform for my VM's. I am also using Argo workflows to rebuild my template every second day so that my template is 100% up-to-date.
@stevendonaldson1216
@stevendonaldson1216 2 жыл бұрын
Thanks Christian. I hope life is going well for you.
@christianlempa
@christianlempa 2 жыл бұрын
Thanks mate! Yeah it's all good, thanks for asking 😀
@zoejs7042
@zoejs7042 2 жыл бұрын
thanks for making this. i've been using the proxmox terraform provider for some time now to provision my k3s cluster. hopefully this video gets the provider more attention since it is lacking in some functionality and has been buggy in some of my experiences
@RODDAL
@RODDAL 2 жыл бұрын
What would you rate the provider's current usability from 1-10?
@jefffrederick258
@jefffrederick258 2 жыл бұрын
I'm glad i found this video.
@christianlempa
@christianlempa 2 жыл бұрын
Thank you! :)
@sussudio4384
@sussudio4384 2 жыл бұрын
To provision a Kubernetes cluster in my Proxmox homelab, it was long and tedious. Before: - I had to create the virtual machines manually from an ISO, - Then I accelerated the process with Cloud-Init images, - But i had to install the packages manually, - Same for the configurations - I make sure to make snapshots of my initial configuration, - If your configuration fails, i delete my machines and we start again... Duration : 15-30 minutes and more.... Now : a Terraform declarative file is enough to get my kubernetes cluster with the desired configuration, Duration : 3 to 5 minutes maximum and a simple "terraform apply" is enough to destroy and rebuild my cluster,
@RahulKumar-hq6wm
@RahulKumar-hq6wm 2 жыл бұрын
Thanks bro your videos are always informative 🔥🔥🔥
@christianlempa
@christianlempa 2 жыл бұрын
Thank you! Glad you liked it 🙂
@dennisdesgehtdichnixan2022
@dennisdesgehtdichnixan2022 2 жыл бұрын
This video came just at the right time. I am planning on doing sth. with that in the next few weeks. Thanks / Danke & Grüße
@christianlempa
@christianlempa 2 жыл бұрын
Vielen Dank! Grüße zurück :)
@MrNoBSgiven
@MrNoBSgiven 2 жыл бұрын
OK... Christian did it again. I am still confused about how Terraform picks the file names to run plan and build without using -var-file parameter. Also, I did have a very ugly moment (lots of "F" word usage🤣 ) as I didn't notice the wrong network subnet specification (my put "0" instead of 24 🤦‍♂️). After that Proxmox created a new cloned VM like a champ. THANK YOU Christian. One more - should anyone try to specify Vlan us "tag =" withing the "network" parameter brackets. Took me a while too. Now a suggestion for video for Christian - a short version for using Terraform to create Proxmox LXD container. It should be long hanging fruit as far as KZbin monatiztion is concerned.
@christianlempa
@christianlempa 2 жыл бұрын
Thanks bro :) great you could solve these issues! Still have other stuff on my list but maybe I'll take a look at LXC at some point 😀
@Sm0rezDev
@Sm0rezDev Жыл бұрын
Now that i have a base image with cloud-init and a disk size of 16gb, If I want to clone it with terraform and i need to increase the disk size for my kubernetes cluster how can I do it without having the exact same parameter? plus i have issue with "virtio0 - cloud-init drive is already attached at 'ide0'"
@phii7u
@phii7u Жыл бұрын
"virtio0 - cloud-init drive is already attached at 'ide0'" -> I also get the same error from time to time and I don't know why when it happens. I am using Proxmox 8 so maybe something has changed between releases.
@georgelza
@georgelza Ай бұрын
please explain qemu... whats its part in this and what does the agent do that you mentioned. other that the api key. what else is set up, from where do you run your Tf scripts... guessing it needs to be pointed at the datacenter address some where? busy downloading repo.
@alexeyromanov
@alexeyromanov 3 ай бұрын
Hi Christian, great video. I am wondering if it is possible to automate Proxmox servers upgrades, not just VMs. Couldn't find a proper playbook
@christianlempa
@christianlempa 3 ай бұрын
That's a good question, I think you can simply do that using the package manager, however it only does the minor updates, not the major ones where you have to update the package sources
@SlingerJames
@SlingerJames 4 ай бұрын
Have you used the Telmate Proxmox provider to install packages or run scripts on newly built virtual machines without using provisioning?
@kevinyu9934
@kevinyu9934 2 жыл бұрын
Nice work! Keep it up bro.
@christianlempa
@christianlempa 2 жыл бұрын
Thanks, will do!
@thiagobarrichelo
@thiagobarrichelo 2 жыл бұрын
This is gold! Thanks for sharing.
@christianlempa
@christianlempa 2 жыл бұрын
Thanks 😉
@padraigconnolly2991
@padraigconnolly2991 2 жыл бұрын
I had to add "-var-file=credentails.tfvars" whenever running terraform plan or terraform apply, is there something missed?
@JamesGreen-gv4yn
@JamesGreen-gv4yn 2 жыл бұрын
The file name must end in `.auto.tfvars` in order for Terraform to automatically use it. You appear to have left out the `auto` part.
@padraigconnolly2991
@padraigconnolly2991 2 жыл бұрын
@@JamesGreen-gv4ynAh perfect thank you!
@Toparlak123
@Toparlak123 10 ай бұрын
Do you have an alternative Terraform provider for Proxmox VE 8? Telmate no longer maintains it.
@manchie18
@manchie18 5 күн бұрын
Does this mean I have to manually change each Ip address since each new vm will have the same IP?
@xclsd-c9l
@xclsd-c9l 6 ай бұрын
What I don't understand: Why not just use the clone-functionality directly in the GUI? At the moment I can't see the advantage of setting this up in code
@maxdiamond55
@maxdiamond55 2 жыл бұрын
Great tutorial, thanks.
@Itshacksmith
@Itshacksmith 8 ай бұрын
Any way to automate linked clone as its only creating a full clone...
@Psyt0s
@Psyt0s Жыл бұрын
I have the exact same settings on the disk block as in Proxmox template. but for some reason, the original disk gets replaced by a new one completely empty of the same size of the original.... I am using: disk { storage = "local" type = "scsi" size = "128G" }
@mikkel3135
@mikkel3135 2 жыл бұрын
Did the same kind of thing in Ansible, and now trying to see if I can make a custom Crossplane provider for it. Automation is awesome!
@twostar-ii380
@twostar-ii380 4 ай бұрын
The cloned VM hostname and IP address doesn't change, any idea why this is happening? (retains same hostname and ip as template)
@christianlempa
@christianlempa 3 ай бұрын
No idea, maybe you could join our discord, share your files and we might be able to help
@هردمبیل-ت2ش
@هردمبیل-ت2ش 6 ай бұрын
Hi Christian, thanks for your video! Is this provider still up-to-date?
@GodAtum
@GodAtum Жыл бұрын
Hi, I followed everything OK. but my VM doesn't pick up the static IP until after I manually reboot it. are you having the same issue?
@AndreaGhensi
@AndreaGhensi 2 жыл бұрын
I am literally doing the same thing, with libvirt instead of proxmox (I figured out I don't need clustering and many other things proxmox offers). I still have to iron out some connection problems, but things are looking good. For vm images, I skipped packer and found suse's MicroOS images, already shipped with k3s (to build my kubernetes cluster, but theres many other flavours)
@tmtb
@tmtb 2 жыл бұрын
Great video, thank you. How would you change this project to create/maintain a list of vms?
@AndreaGhensi
@AndreaGhensi 2 жыл бұрын
If they are identical you can use "count" to specify how many vms you need; if you need to do some adjustments you can build a list of objects and use "for_each" to iterate the objects; if they are completely different, you ca declare multiple "proxmox_vm_qemu" resources
@christianlempa
@christianlempa 2 жыл бұрын
I use a single Git Repo for my Proxmox VMs in Terraform. And I split the multiple projects into separate .tf files. That's probably not the best way to do it, but the only way I know :D
@rabbanidar
@rabbanidar 2 жыл бұрын
Did you clone from the template which had cloudint disk attached? I did and it deployed the VM fine took the cloudint settings and all was good. But then if I rerun the terraform apply it always tries to update the VM with removing the cloudint disk. I assume this is because in the plan I didn't define cloudint disk?
@r3v0luti0ndud3
@r3v0luti0ndud3 7 ай бұрын
whats the name of your vscode color theme?
@silverioantolo1008
@silverioantolo1008 2 жыл бұрын
I follow your setup but still this appears>> Error: invalid character '
@Lamoboos223
@Lamoboos223 Жыл бұрын
can i make the new vm have different storage size than the parent vm?
@m8_981
@m8_981 2 жыл бұрын
Hi, im wondering how to use this in production. Do you just have 1 project where you manage all your virtual mashines from?
@christianlempa
@christianlempa 2 жыл бұрын
That's how I currently do it because for me, it's just easier to manage everything in a single proxmox-terraform project. But you could also split it into multiple projects.
@1Copenut
@1Copenut Жыл бұрын
Great video Christian. I’m looking forward to getting up to speed with Packer and Terraform. How are you generating the SSH key for your TF provision script? Is it the same key being used for all VMs?
@goodgameplays9571
@goodgameplays9571 10 ай бұрын
did you find a solution for this please ?
@enderst81
@enderst81 2 жыл бұрын
Any plans to add Ansible to this would be awesome.
@DavidIduate
@DavidIduate 9 ай бұрын
Can you make a video of how to use the username and password instead of the API token and Api secret, I keep getting errors
@davideferrero3068
@davideferrero3068 2 жыл бұрын
I set a password with cipassword under ciuser, and i can login with those credentials, ani hints?
@reboundpt4987
@reboundpt4987 Жыл бұрын
Nice vid! If I don't pass a password for the user in my .tf files, somehow I can login? I'm using ssh keys, but it keeps prompting my for password, although I have not given any passphrase. Any ideas?
@angelosnm
@angelosnm 2 жыл бұрын
Amazing!
@MahdiYusuf
@MahdiYusuf 2 жыл бұрын
Great video! Keep it up dude!
@christianlempa
@christianlempa 2 жыл бұрын
Thanks! I'll do
@winstonsmith6259
@winstonsmith6259 Жыл бұрын
Having trouble getting the provider working, in this case Telmate terraform-proxmox-provider and provisioner. The video seems to gloss over that important detail. As do the others. Meh..
@g-luu
@g-luu 2 жыл бұрын
Amazing... thank you.
@christianlempa
@christianlempa 2 жыл бұрын
You’re welcome
@DavidIduate
@DavidIduate 9 ай бұрын
Does anyone know how to use the username and password for Proxmox to deploy instead of using the token and secret? Please it's urgent
@christianlempa
@christianlempa 9 ай бұрын
I'm sorry, but you have to refer to the official docs of Proxmox, which needs the API interface to perform automated actions (which requires API token to authenticate)
@DavidIduate
@DavidIduate 9 ай бұрын
@@christianlempa is there a way I could text you privately?
@ewoks42
@ewoks42 Жыл бұрын
still waiting for Ansible version of this video... ;)
@artemsolovev9231
@artemsolovev9231 Жыл бұрын
not working for me
@bogy5259
@bogy5259 Жыл бұрын
I dont See the Advantage... You still have to Set every Parameter (IP etc.) Manually But in a File with an extra Thing. Do it in proxmox is way simpler
@christianlempa
@christianlempa Жыл бұрын
I think we need to look at the bigger picture why it’s important to learn IaC instead of just Homelab usage. It’s an important skill in professional IT, and the learning benefit is huge!
@sussudio4384
@sussudio4384 2 жыл бұрын
crash for me......
@andydiep4162
@andydiep4162 2 жыл бұрын
noice
@xrehpicx
@xrehpicx Жыл бұрын
Gru
@darahk88
@darahk88 9 ай бұрын
learning another language for what? isn't any better graphical alternative?
Create VMs on Proxmox in Seconds!
25:04
Christian Lempa
Рет қаралды 139 М.
What is infrastructure as code? // Terraform Tutorial
30:24
Christian Lempa
Рет қаралды 36 М.
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
Automate Homelab Deployment With Terraform & Proxmox
26:22
Jim's Garage
Рет қаралды 71 М.
Crazy fast Kubernetes Automation with Terraform
26:23
Christian Lempa
Рет қаралды 102 М.
I automated EVERYTHING in my HomeLab // Kestra #2
30:56
Christian Lempa
Рет қаралды 39 М.
Don’t run Proxmox without these settings!
25:45
Christian Lempa
Рет қаралды 308 М.
Simplify Your Proxmox VE Tasks: Ansible Automation Made Easy
19:42
Tech Tutorials - David McKone
Рет қаралды 13 М.
Perfect Proxmox Template with Cloud Image and Cloud Init
11:51
Techno Tim
Рет қаралды 120 М.
My NEW HomeLab automation platform // Kestra
38:36
Christian Lempa
Рет қаралды 120 М.
Proxmox NETWORKING: VLANs, Bridges, and Bonds!
25:09
apalrd's adventures
Рет қаралды 165 М.
This web UI for Ansible is so damn useful!
20:07
Christian Lempa
Рет қаралды 504 М.
Google’s Quantum Chip: Did We Just Tap Into Parallel Universes?
9:34
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН