Proxmox Templates Made Easy: Ansible Automation

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 34

  • @Tom_The_GCT
    @Tom_The_GCT Рік тому

    for school i am like trying to make an template that has pre installed docket on it, can you specify this aswell in a template playbook?
    because the goal for my school project is that as much as possible gets automated. so that would be basically where you have install qemu agent
    thats where i would need to specify docker correct?

    • @JamesRhoat
      @JamesRhoat  Рік тому +1

      The proxmox templates that were created here are more like base images that can be used to create new VMs from. If you want to initialize a docker vm from these templates, id recommend using the qm clone command this will create a new VM from the template. Which then can be bootstrapped with docker via another playbook.
      The other approach is what I am planning to cover in the future which is just using the standard cloud init method and providing a cloud init config file to the VM. This will allow you to bootstrap the VM with docker and other tools without using the proxmox templates. this can be accomplished with --cicustom [meta=] [,network=] [,user=] [,vendor=]
      This second method is more flexible and is the approach cloud providers like AWS and GCP use. However, If you want to use the proxmox templates in place, just build a playbook that uses the clone command, waits for the VM to be ready, then runs a docker bootstrap playbook.
      If you want to discuss it a bit further, I am happy to continue the conversation in the comments or via email (In the about section of my channel).

    • @The8BitHero
      @The8BitHero 5 місяців тому

      @@JamesRhoat That second method also looks interesting. I'll have to dig into that more.

  •  Рік тому +1

    elegant setup, thanks for sharing the ansible playbook

    • @JamesRhoat
      @JamesRhoat  Рік тому

      Glad you found it useful! If you have any questions or suggestions, feel free to share.

  • @jeffdunn890
    @jeffdunn890 10 місяців тому

    This is awesome! Exactly what I was looking for to use in my home lab. -Thanks so much.

  • @floriantthebault521
    @floriantthebault521 Місяць тому

    I’m curious, I’ve been using terraform to provision VMs and Ansible to configure them. But you seem to use only Ansible. What’s the advantage ?

  • @The8BitHero
    @The8BitHero 5 місяців тому

    Exactly what I was trying to do. I read those same tutorials you did I'm sure. I kept thinking, but why aren't you automating the template creation? One had a shell script for it but I'd rather have the extra flexibility of Ansible.

  • @amac1211
    @amac1211 Рік тому

    Great stuff, really like the timestamps, super helpful and great content.

  • @markstanchin1692
    @markstanchin1692 8 місяців тому

    That’s incredible! I’m over here with the two node Prox cluster, which I just figured out how to create a cluster, and I’m going to configure a third node and trying to figure out how I can keep all the configs of proxmox, etc. the same. Next will be shared storage. I Will be adding 22.04 & Debian etc. templates to experiment with. Can you say mental overload? I’m thinking this video may be a bit advance for me, but then I’m thinking maybe this is the way I should go.

  • @squalazzo
    @squalazzo 9 місяців тому

    what about updating those images packages before converting them to templates? This way on 1st boot the vm would be already updated, or you can have the templates upgraded periodically

  • @DMBrownlee
    @DMBrownlee Рік тому

    Great video! I did the same thing a few months back but, not being that familiar with the qm command line, I had ansible build the template VM using HashiCorp packer. Same idea, different approach.

    • @JamesRhoat
      @JamesRhoat  Рік тому

      That's awesome, do you have your code somewhere that I could review? I'd love to see some of the differences between the solutions.

  • @BigFourHead
    @BigFourHead 11 місяців тому +1

    can you gert a mic that records your voice at a louder vol. 100% on youtube and Speakers and im still trying to hear you.

    • @JamesRhoat
      @JamesRhoat  11 місяців тому

      Hey, I appreciate the feedback. I do have a sm7b microphone which is pretty solid however they can be pretty low volume wise. I will work on it and hope you stick around :)

  • @zulhilmizainudin
    @zulhilmizainudin Рік тому +1

    Very useful. Thank you for sharing this. Could you create another video on how to add custom cloudinit? The default cloudinit template provided by Proxmox is quite limited. I'm not saying having the ability to set the default user and password is not useful - it does. But sometimes you need to add more to the cloudinit e.g. allow/disallow that default user to run `sudo` with/without entering password, what packages to install by default, setting timezone & etc. We can't easily do this via default cloudinit template provided by Proxmox. Would be great if you can share your process around this using Ansible (or other tools) so we can automate it without doing too much ClickOps using the Proxmox web UI. Thanks!

    • @JamesRhoat
      @JamesRhoat  Рік тому +1

      I have a plan to make this video as I am limited here as well, one of the limitations I ran into was not being able to add all my users and authentication methods. So I defaulted to ansible as the main user.
      I have a plan to do a video for this, is there anything specifically you would like to take advantage of in cloud-init so I can make sure to cover it?

  • @danbrown586
    @danbrown586 11 місяців тому

    I think it's because I'm not very (or at all, really) familiar with Ansible, but I seem to be missing a step and/or some context. I have Ansible installed on my desktop machine, and it's easy enough to download your repo, create vars/main.yml with appropriate edits, and create the playbook itself--that would appear to be proxmox_cloudinit.yml, at the root of the repo? The hosts: line would be edited to point to the hostname of my Proxmox server, persumably. But then what? You're showing running ./build/scripts/run.sh--where does that come from?
    Clearly I'm missing some important background information. Is there someplace more specific than "read the Ansible docs" I should start to look?

    • @JamesRhoat
      @JamesRhoat  11 місяців тому

      Hey, I’ve been sick with Covid the last few weeks. I’d love to help resolve these issues. Can you send me a email through my about me on my channel or a GitHub issue? I’d be happy to reach chat I just think UA-cam comments wouldn’t be a great method of communication for this.
      But if not, the hosts entry should point to a host inside your hosts file, helps keep things organized. The reason I use the run script is because I’m kicking off the ansible command from a docker container if you look at the pragmatic engineering GitHub organization, there will be a repo that is called the ansible engine. This has that run.sh script if you want to look at it, in essence though you just want to run the ansible-playbook command passing in your vars and playbooks and anything else you need.
      As a side note for getting started with ansible I always recommend the book from Jeff geerling, the guy’s a master at ansible. I believe he’s still giving that book away for free but if not it’s 10$ on leanpub and it’s well worth the money.

    • @martinsloan5760
      @martinsloan5760 4 місяці тому

      @@JamesRhoat thanks for the great repo and video on this. Just adding my 2 cents since I'm in the same boat as @danbrown586. Obfuscating the final piece of this workflow makes it difficult for those not intimately familiar with ansible to make use of your work. Maybe you assume that one should have ansible experience coming in and that's fine, but if you just showed us how to run the ansible playbook without obfuscating the commands, I think it'd be a lot more useful in general. I like ansible and would like to learn more about it, but TODAY I'm just trying to automate some VM's in proxmox :-) Thanks for your time.

  • @CTWilliams89
    @CTWilliams89 Рік тому

    I am having an issue where after cloning the template the vms are all being given the same ip address even though dhcp is set. I assume it has to do with the machine id. Any suggestions or can you reproduce?

    • @JamesRhoat
      @JamesRhoat  Рік тому

      I did notice this after publishing the video, now that more people are using the templates I actually logged an issue on the github repository describing it and how to resolve it for the machines you created so far.
      I also put my thoughts on how to fix it in the ansible role. If you want to take a crack at fixing it I am here to help, otherwise I will fix this when I get some free time to test the implementation.

    • @CTWilliams89
      @CTWilliams89 Рік тому

      @@JamesRhoat Awesome, I think I fixed it I will make a pull request shortly

    • @JamesRhoat
      @JamesRhoat  Рік тому

      Appreciate the help :)

  • @bobjapan7690
    @bobjapan7690 Рік тому +4

    surprise he made an error and didn't edit it out to make himself look perfect! Instead he highlights it, tells you what caused it and how to fix it. That's different.

    • @JamesRhoat
      @JamesRhoat  Рік тому +1

      Appreciate the insight, I hope to share more behind the scenes in the future!

  • @unmatal
    @unmatal Рік тому

    Good one

    • @JamesRhoat
      @JamesRhoat  Рік тому

      Thank you! glad you enjoyed it!

  • @fusau3834
    @fusau3834 Рік тому +1

    Out of interest, why are you baking things like SSH keys and machine config (CPU/memory etc) into the template rather than using something like terraform to configure those at instantiation?

    • @JamesRhoat
      @JamesRhoat  Рік тому +1

      Honestly, I just wasn't a fan of the provider for terraform, I know alot of people use it, however, it does require the iso to exist already in a storage pool to create a VM that is not a clone. With ansible, I was able to pull the isos from a remote server and place them where they needed to be, which at that point i could have switched. But it just seemed clunky to switch out of one process for automation into another. My main goal was to get templates up to make it easier to configure and for that I wanted to remove the manual iso sync as it makes it more repeatable, in case I ever blow up my node or disk fails.
      If you have an implementation of terraform where this was done Id love to see it!

    • @JamesRhoat
      @JamesRhoat  Рік тому +1

      I want to also add the reason I bake these in are because it makes it easier to provide my default settings that I normally work with for small vms. Meaning when I am just messing around with a project, or want to demo something real quick like an iperf3 test and then break down the machine I am able to do so quickly by just having a vm that can be cloned in 20 seconds and started with another 30 seconds. This template model is also similar to cloud providers, meaning that you can define a scheme associated to your vms. E.G. 2core 4gb small 1core 2gb xsmall 4core 8gb medium, I don't do this now, but its something that could be considered for automation sake, spinning up a vm to run a pipeline and then breaking it down could be easier if you are providing terraform a vm with the appropriate settings.

  • @kurtbrown7504
    @kurtbrown7504 10 місяців тому

    when running this I get the following error
    TASK [proxmox/cloud-init : Read the VM list JSON file] *******************************************************************************************
    fatal: [PROXMOX-01]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (command) module: cmd Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends, warn"}

    • @JamesRhoat
      @JamesRhoat  10 місяців тому

      Good evening, would you mind opening GitHub issue? This way I can assist you further