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

    Ansible dynamic inventory and XO

    Scheduled Pinned Locked Moved Xen Orchestra
    11 Posts 3 Posters 1.2k Views 1 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.
    • kirovtomeK Offline
      kirovtome
      last edited by

      I was just wondering if anyone is using an Ansible dynamic inventory script with XO, could you share it please? I'm trying to save some time not to write my own python script over xo-cli though.

      Thanks in advance.

      luizhpriottoL 1 Reply Last reply Reply Quote 0
      • luizhpriottoL Offline
        luizhpriotto @kirovtome
        last edited by

        @kirovtome I have found this script https://github.com/vtsingaras/xenorchestra_inventory...

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

          Can you describe a bit more your use case and what do you want to achieve? (functionally speaking)

          luizhpriottoL 1 Reply Last reply Reply Quote 0
          • luizhpriottoL Offline
            luizhpriotto @olivierlambert
            last edited by luizhpriotto

            @olivierlambert @kirovtome I have created a simple way to return the dynamic inventory to use on Ansible. https://github.com/luizhpriotto/xenorchestra_inventory

            I think the https://github.com/vtsingaras/xenorchestra_inventory doesn't work anymore.

            Thanks.

            kirovtomeK 2 Replies Last reply Reply Quote 1
            • olivierlambertO Offline
              olivierlambert Vates 🪐 Co-Founder CEO
              last edited by

              I'm not an Ansible expert, what is the purpose of Ansible inventory? What's your use case exactly?

              luizhpriottoL 1 Reply Last reply Reply Quote 0
              • luizhpriottoL Offline
                luizhpriotto @olivierlambert
                last edited by luizhpriotto

                @olivierlambert in Ansible we have to create a static file with groups and ip of vms to run owner playbooks.

                My solution is a simple way to create this file using tags like groups and getting the ip automagically, like this:

                [kub] #xo tag
                192.168.1.152 #vm ip
                192.168.1.42 #vm ip

                [worker]
                192.168.1.152

                [2021.01]
                192.168.1.152

                [XOA]
                192.168.1.152

                [master]
                192.168.1.4

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

                  So your playbook will automatically "sort" VMs category using tags in XO?

                  luizhpriottoL 1 Reply Last reply Reply Quote 0
                  • kirovtomeK Offline
                    kirovtome @luizhpriotto
                    last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • kirovtomeK Offline
                      kirovtome @luizhpriotto
                      last edited by

                      @luizhpriotto Awesome! I'll check it out later today. Cheers!

                      1 Reply Last reply Reply Quote 0
                      • luizhpriottoL Offline
                        luizhpriotto @olivierlambert
                        last edited by

                        @olivierlambert exactly!

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

                          Nice 🙂

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