Streamline VM Deployment: Ansible Automation for Proxmox VE

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

КОМЕНТАРІ • 33

  • @MenkarX
    @MenkarX 10 місяців тому +5

    Such effort is definitely deserves like and subscription! Thanks a lot.

  • @373323
    @373323 4 місяці тому +2

    this is awesome, and extremely useful, very good detail

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

      Good to know this was useful
      I found it surprising how much time I was spending even just cloning a template
      So I want to automate as much as possible

  • @mariobader2152
    @mariobader2152 10 місяців тому +2

    Ahhh the weekend is saved...
    I'll definitely recreate one or two things

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  10 місяців тому +1

      I'm hoping to have everything under the control of Ansible
      But I know some systems don't offer unattended installs so it could be tricky
      Hmm..I wonder if I should ask ChatGPT to handle those ones...

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

      @@TechTutorialsDavidMcKone At the moment, as the last step of a rollout, I name the new computers using Ansible and enter their hostname and IP in the BIND-DNS server using Ansible, too, so that my entire rollout works via Ansible. So I have a separate rollout for each role, whether web server, file server or database server 🙂 I hope you can understand my English to some extent

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  10 місяців тому +1

      @@mariobader2152 Yeah that makes a lot of sense
      It's interesting what can be done with Ansible

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

      @@TechTutorialsDavidMcKone I love Ansible, is a good bridge between infrastructure and programming

  • @torbenkorte1156
    @torbenkorte1156 2 місяці тому +1

    really great video. Lots of information, well explained and presented. Only the meaning of the variable creation was not clear to me. Why don't you just create the variables in a file without the hassle of putting them together?
    You don't gain any flexibility that way, or am I missing something here?

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  2 місяці тому

      For me it's a bit more flexible as I can maintain each VM independently and I don't end up with one big file
      If I no longer need a VM I can delete its file and next time it won't get added into the master file
      If everything is in one file I'll have to search for the specific set of information to remove
      Of course, if I want to add a new VM I just need to add a new file

    • @torbenkorte1156
      @torbenkorte1156 2 місяці тому

      ​@@TechTutorialsDavidMcKone thanks for the clarification, i can understand that very well. I simply packed the desired vms into a global variable file. However, I also make my own ansible script for each rollout.
      What remains is that your video was a great introduction to working with proxmox, thanks again.

  • @daxcor
    @daxcor Місяць тому +1

    I have been trying to recreate this playbook. One thing you skipped over is the proxmox_kvm package. Where does this come from? From the error I get, it is from a pip module called proxmoxer. How did you install this? from the error, it looks like it is wanting the pip module on the proxmox server itself. Can you elaborate on how you did this please.

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

      I should have made that clearer in the assumptions chapter
      There's a prior video showing how to onboard PVE so Ansible can manage it and includes installing proxmoxer
      ua-cam.com/video/4G9d5COhOvI/v-deo.html

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

      ok, now that makes more sense.

  • @geekinuniform
    @geekinuniform 10 місяців тому +1

    I was able to successfully create this, great work. HOWEVER, have you attempted using Ubuntu cloud init? what challenges did you encounter?

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

      I don't use Ubuntu anymore but it should be fine as Canonical started cloud-init
      As far as I'm aware you should also have more options available

  • @jdratlif
    @jdratlif 6 місяців тому +1

    Where did you find that import-from property in the scsi section when creating the host? That's not documented in the community.general collection, but I think it will solve a problem I had with this where I had t be root (not root API token, ROOT) to import the disk image because only root can import from a raw disk path. That's a really nice fix for that which I will be trying RIGHT NOW. Thanks.

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  6 місяців тому +2

      Ansible modules are usually just overlays for commands
      You can do a lot with Proxmox using the qm command
      pve.proxmox.com/pve-docs/qm.1.html
      In there you'll find information about options like "import-from"

    • @jdratlif
      @jdratlif 6 місяців тому

      @@TechTutorialsDavidMcKone I hadn't looked at the module code or the qm CLI which is surely just wrapping the API. I stopped at the community.general docs where it said "it supports these properties", and its lists literally TWO out of the nearly FORTY that are in the qm create section of the manpage. I need to go make a pull request on those docs. Thanks again.

  • @daxcor
    @daxcor Місяць тому +1

    The ubuntu cloud init image is a .img file and not qcow2 like Debian. So I am assuming that I have to convert it to qcow2.
    I used this code
    # Convert .img to qcow2
    - name: Convert the image to qcow2 format
    ansible.builtin.command:
    cmd: qemu-img convert -f raw -O qcow2 '{{image_path}}{{item.cloud_init_file_img}}' '{{image_path}}{{item.cloud_init_file_qcow2}}'
    loop: "{{os_images}}"
    when: 'item.state == "present"'
    The play book runs without error, however the vm won't book, says no boot disk found. Any thoughts on what I am doing wrong?

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

      I haven't used Ubuntu in a long long time and I try to avoid img files
      There is this on the Proxmox site for using Ubuntu and img files
      pve.proxmox.com/wiki/Cloud-Init_Support
      But that's the longer and preferred path of creating your own image files to deploy

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

      Looks like it is a known bug with proxmoxer, I guess I will use debian.

  • @JamesTremblay
    @JamesTremblay 7 місяців тому +1

    Would you consider an update to this that is more AWX or include dynamic cars? I. E. Query the user for vmname, vmid, CPU, memory, disk size, ipaddress, mask and gateway?

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому

      Probably not because my long term goal is to just set up Ansible to configure and maintain everything using a few playbooks
      I prefer to keep things simple, so the aim of the playbooks is to just build the VMs from the ground up, install the relevant application software to each VM and then just regularly apply software and config updates

    • @JamesTremblay
      @JamesTremblay 7 місяців тому

      @@TechTutorialsDavidMcKone my goal too, but I didn't want to have to make changes, commit, sync to AWX then deploy. AWXs survey tools eliminate some of if those steps...

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому

      @@JamesTremblay I opted for a simple cron job solution basically, using Semaphore
      So I setup and maintain Ansible as normal but then Semaphore runs the playbook(s)
      This way I don't touch Semaphore anymore, unless there's an alert to say a task didn't run for instance

    • @JamesTremblay
      @JamesTremblay 7 місяців тому

      @@TechTutorialsDavidMcKone I don't see how a cron job helps with deploying new guests.

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому

      @@JamesTremblay I have VM files which define the "hardware" specs of each VM I want
      So if I want to create a new VM I create a new file and the build playbook will create that VM the next time it runs
      But that only goes as far as the OS installation and some basic settings to make sure only Ansible has access to the VM through SSH
      The maintenance playbook is next and covers applications and configurations
      All VMs in the inventory are updated with common settings like time, SSH, etc
      But each application group has its own specific software and the configs that go with it
      So new VMs will get software installed and it will be configured, while existing VMs will have config updates if needed
      It's what I like most about Linux as the config files are text files, so it's easy to upload a change and restart a service

  • @vincentchov5760
    @vincentchov5760 7 місяців тому +1

    Do you have the full codebase for this somewhere so it can be read easier? Thanks!

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому

      You can find more details in my blog for this
      www.techtutorials.tv/sections/promox/automate-vm-creation-on-proxmox-with-ansible/

    • @vincentchov5760
      @vincentchov5760 7 місяців тому

      @@TechTutorialsDavidMcKone my question was in regards to that guide. Is the codebase on github so I can look at it as a whole?

    • @TechTutorialsDavidMcKone
      @TechTutorialsDavidMcKone  7 місяців тому

      I haven't put anything on github yet
      Currently I'm just uploading sections of code as per the videos I put out