XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Ansible and XCP-ng

    Scheduled Pinned Locked Moved Development
    12 Posts 5 Posters 4.2k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ruskofdR Offline
      ruskofd
      last edited by ruskofd

      Hello everyone,

      On this gray weather here in Malta, I was thinking about some things I could try on XCP-ng with Ansible. Ansible will be my next learning priority and I would like to automate and extend some things on XCP-ng (i'ill be back in the XCP-ng game on my lab soon). So there are some ideas on what I will work and obviously I will put this open to everyone.

      • Automatic installation of PVHVM drivers/Xen Tools for Linux (native) and Windows (native with WinRM module). Seems very simple on Linux, maybe less on Windows.
        With this possibility, I was wondering if it's possible to imagine a feature that "call" an Ansible playbook in XenOrchestra to directly install these drivers in an hassle-free way. For example, is it possible to wait for a reboot of a Windows VM so this could give the opportunity to install the XCP-ng drivers without doing some manual reboot and so on. And maybe manage the inventory file on XO or directly fill this file with the VM installed on XO. (just ideas, pure theory 😅 )

      • Deployment of virtual machine and management querying the XO API or XAPI. This is something very important to me, deploy VM from templates to gain time, and it could be better with Ansible 😉 Or maybe imagine some others common task to automate.

      • Build XenOrchestra from sources. There are already some scripts, but I would like to deploy XO instances on hosts remotly using Ansible. I have other ideas around this, I will continue thinking on it.

      There are my first ideas on which I will working on on the next months, if you have opinions, advices or other ideas, don't hesitate.

      C 1 Reply Last reply Reply Quote 0
      • C Offline
        cheese @ruskofd
        last edited by

        @Ruskofff There are already some modules about XenServer within Ansibe sources. Just find 'xenserver'. I hope you can use them as start point.

        1 Reply Last reply Reply Quote 0
        • olivierlambertO Online
          olivierlambert Vates 🪐 Co-Founder CEO
          last edited by olivierlambert

          I would suggest terraform on xo-cli or XO API (easier to have one entry point for the whole infrastructure, means less work on the layer on top)

          1 Reply Last reply Reply Quote 0
          • ruskofdR Offline
            ruskofd
            last edited by

            I already check xenserver with Ansible and I didn't find some things that seems up to date. And I agree with Olivier, I would like to query directly XO than the XAPI.

            These are idea for Ansible playbook in the first time, I need to learn Go and Python from scratch before thinking create some modules.

            1 Reply Last reply Reply Quote 0
            • ruskofdR Offline
              ruskofd
              last edited by ruskofd

              Edit : I found the Ansible module you talking about cheese (with the other topic talking about Ansible on XenServer). I could start from this point for the deployment of VM yes. Seems good for me !

              Concerning Terraform, I check some code source on Github with the official documentation from Hashicorp, I need much more time to understand everything... I need more development practice 😧

              But for now, I will fully focus on Ansible.

              B 1 Reply Last reply Reply Quote 0
              • B Offline
                bvitnik @ruskofd
                last edited by

                @Ruskofff said in Ansible and XCP-ng:

                Edit : I found the Ansible module you talking about cheese (with the other topic talking about Ansible on XenServer). I could start from this point for the deployment of VM yes. Seems good for me !

                This is the thread:

                https://xcp-ng.org/forum/topic/159/deploy-vms-using-ansible

                I'm the author of the module. The thread is a little outdated but I will update it ASAP. Feel free to ask me anything regarding the module.

                1 Reply Last reply Reply Quote 1
                • ruskofdR Offline
                  ruskofd
                  last edited by

                  Indeed, this is this one ! I will check your module to see what can it bring to me. I already tried with the XAPI how can I do certain things for the first idea that I posted above, I will check later how can I do that with your module.

                  B 1 Reply Last reply Reply Quote 0
                  • B Offline
                    bvitnik @ruskofd
                    last edited by

                    @Ruskofff I've updated the thread with new info regarding my modules.

                    The biggest advantage to using the modules instead of using xe tool or calling XAPI methods is that modules follow Ansible's idempotency principle. So you can run your Ansible playbooks multiple times without worrying that Ansible will do anything more times than expected.

                    1 Reply Last reply Reply Quote 0
                    • N Offline
                      nhanlon
                      last edited by

                      This thread reminds me I should think about open sourcing our ruby implementation of the XO API...

                      1 Reply Last reply Reply Quote 0
                      • ruskofdR Offline
                        ruskofd
                        last edited by ruskofd

                        bvitnik I propose to put your explanation of the other topic to the XCP-ng wiki, it could be very useful for everyone who want to use the module.

                        The link : https://github.com/xcp-ng/xcp/wiki

                        I have a question about your module "xenserver_guest". Is it able to modify settings of the VM ? My main interest will be to mount the guest-tools.iso file to the VM. It's easy with the xe cli but I can't test it now that why I'm asking this.

                        B 1 Reply Last reply Reply Quote 0
                        • B Offline
                          bvitnik @ruskofd
                          last edited by bvitnik

                          @Ruskofff said in Ansible and XCP-ng:

                          I have a question about your module "xenserver_guest". Is it able to modify settings of the VM ? My main interest will be to mount the guest-tools.iso file to the VM. It's easy with the xe cli but I can't test it now that why I'm asking this.

                          Of course. Check out "cdrom" module parameter in the docs.

                          1 Reply Last reply Reply Quote 0
                          • ruskofdR Offline
                            ruskofd
                            last edited by

                            Perfect ! I was thinking that is only available during the deployment of a VM (I need more experience on Ansible 😂)

                            I will give a try as soon as I get the possibility to use Ansible.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post