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

    Deploy VMs using Ansible

    Scheduled Pinned Locked Moved Development
    29 Posts 14 Posters 18.6k Views 5 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.
    • B Offline
      bvitnik
      last edited by bvitnik

      Hi guys,

      Sorry if this looks like shameless self promotion but for a few weeks now I've been working on Ansible module for managing XenServer/XCP-ng VMs - first of it's kind if I'm not mistaken. The module is in line with what Ansible offers for VMWare and there is a pull request to mainline it. What I would love is for anyone willing to help, and already familiar with Ansible, is to spare some time to test the module since the only way to test it is against real hardware. Of course, the module should not be tested in production environments.

      UPDATE: 2019-03-01

      Some of my Ansible modules have been merged upstream and are currently available in development version of Ansible. Ansible 2.8 will be the first official release to include these modules.

      My work is currently centered around these three modules:

      • xenserver_guest - upstreamed - used for deployment of new VMs from templates and reconfiguration of existing VMs.
      • xenserver_guest_facts - upstreamed - used for getting VM facts (useful XenServer/XCP-ng VM params).
      • xenserver_guest_powerstate - upstreamed - used for controlling VM power state (running/halted/suspended), graceful shutdown and reboot etc.

      For anyone interested in using/testing these modules, upstreamed modules can be acquired by cloning Ansible repo from GitHub (or downloading the ZIP archive) and running Ansible from source. Instructions can be found here:

      https://docs.ansible.com/ansible/devel/installation_guide/intro_installation.html#running-from-source

      To use the modules, you will also need XenAPI.py from here:

      https://raw.githubusercontent.com/xapi-project/xen-api/master/scripts/examples/python/XenAPI.py

      Copy the file to your Python site-packages (e.g. /usr/lib/python2.7/site-packages/ on CentOS 7).

      You can get module documentation by running this command:

      $ ansible-doc <module_name>
      

      or from official Ansible docs (upstreamed modules only):

      • https://docs.ansible.com/ansible/devel/modules/xenserver_guest_module.html#xenserver-guest-module
      • https://docs.ansible.com/ansible/devel/modules/xenserver_guest_facts_module.html#xenserver-guest-facts-module
      • https://docs.ansible.com/ansible/devel/modules/xenserver_guest_powerstate_module.html#xenserver-guest-powerstate-module

      CHANGELOG:

      • Fixed a bug on XenServer 7.1 with Cumulative Update where a version could not be properly detected, causing an exception.

      Thanks.

      1 Reply Last reply Reply Quote 1
      • borzelB Online
        borzel XCP-ng Center Team
        last edited by

        Cool, will look at this if I find some time somehow...

        1 Reply Last reply Reply Quote 0
        • olivierlambertO Offline
          olivierlambert Vates πŸͺ Co-Founder CEO
          last edited by

          Would be interesting to have an Ansible module for XO, because you also have an API, but this one it's connected to all your pool master. So it's an idea central point πŸ™‚

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

            olivierlambert First thing first πŸ˜‰

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

              So did anyone have a chance to test the module? I need some feedback (good, bad, anything...) if module is to be included as an official Ansible module. Lack of external testers is currently a show stopper 😞 .

              1 Reply Last reply Reply Quote 0
              • stormiS Offline
                stormi Vates πŸͺ XCP-ng Team
                last edited by

                Up-ing this topic in case it helps finding testers.

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

                  Thanks stormi. Still no testers thou. I found one critical bug that effectively prevents deployment 🀦. Reconfiguration of existing VMs works as expected πŸ™‚ . I have prepared a commit to fix a bunch of bugs I found in the mean time but I haven't pushed it to GitHub repo yet. To lazy I guess 🀷. If someone is eager to test, I'll push it right away.

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

                    Hi everyone. For anyone interested in testing, GitHub repo is now updated with latest commit that includes fixes for a number of bugs including a bug that effectively prevented deployment of new VMs. Also, the module is now based on the latest Ansible 2.8 devel code base.

                    As always, any testing feedback would be very much appreciated, good or bad.

                    AddeA 1 Reply Last reply Reply Quote 0
                    • AddeA Offline
                      Adde @bvitnik
                      last edited by

                      bvitnik
                      I cant do any testing yet tho my internet is not connected until oct 31.. 😞
                      But I will see what I can help with later on πŸ™‚

                      borzelB 1 Reply Last reply Reply Quote 1
                      • borzelB Online
                        borzel XCP-ng Center Team @Adde
                        last edited by borzel

                        Adde just wondered how you sent these letters to the forum πŸ€” ... magic ... without the internetzzz...

                        AddeA 1 Reply Last reply Reply Quote 0
                        • AddeA Offline
                          Adde @borzel
                          last edited by

                          borzel Shhhh....Not so loud,,, my boss can hear u πŸ™‚

                          Kidding....lol sitting at work, there I have internet πŸ™‚

                          1 Reply Last reply Reply Quote 0
                          • B Offline
                            BitSprocket
                            last edited by

                            I am running XCP-NG vn 7.6 on two HP Proliant 380G5s and would love to help develop. I'll get it going and let you know how it goes. My machines don't run anything that is mission critical so if something breaks - it's all good. I don't check forums very often so if you want to communicate directly I can be reached at bitsprocket at g mail dot com

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

                              BitSprocket Hi. Thanks for stopping by. Info in the first post is a little outdated. I'll update it soon. The main thing is that my Ansible module for deployment of VMs is now merged in upstream Ansible so you should just get development version of Ansible to get access to my module. Feel free to ask me anything here. I'll be glad to help you get it up and running.

                              UPDATE: I've updated the first post with fresh info.

                              D 1 Reply Last reply Reply Quote 0
                              • D Offline
                                desnudopenguino @bvitnik
                                last edited by

                                I just set up xcp-ng on a host, in the next week or so, i might give this a try! thank you for putting together this module!

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

                                  desnudopenguino Thanks πŸ‘ .

                                  I've updated the first post with some more info and clarified some confusing stuff.

                                  1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    jthompson333
                                    last edited by

                                    I hate to be one of those double posters... Forgive me, as I have not been following the whole split of xenserver opensource vs. closed source. Just not sure which forum gets checked more often these days.

                                    I was testing out this ansible module with XenServer 7.1 CU2 and running into some errors.
                                    Posted about it here:

                                    https://discussions.citrix.com/topic/396848-deploy-vms-using-ansible/?csrfKey=b09a1d8e79f3ea686583c72352cef53d

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

                                      jthompson333 No problem. I'm following both forums so I'll try to respond same day.

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

                                        First post has been updated with new info. Another module has been merged upstream. Also some bugs were fixed.

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

                                          A milestone has been achieved 😱 . All of my modules have been merged upstream. I've updated the first post with new info.

                                          That will most probably be all for Ansible 2.8. I'm keeping some improvements and possibly more modules for Ansible 2.9. Currently, I'm thinking about what other modules could be useful so I could implement them. Any suggestion or wish would be much appreciated.

                                          1 Reply Last reply Reply Quote 2
                                          • C Offline
                                            cmuzyunda
                                            last edited by

                                            Great news , i will test your module in our DR environment and will provide any feedbacks (good or bad ) , please bear with me .....

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