Sorting out APIs and Ansible Modules
-
The Ansible docs from here: https://docs.ansible.com/ansible/latest/collections/community/general/xenserver_guest_module.html
Seem to indicate the host is the XCP server, not XO, and differ from the blog I found here:
https://xen-orchestra.com/blog/virtops3-ansible-with-xen-orchestra/ (which appears to have quit a bit of age on it now)..The problem is we're trying to POC Ansible automation in deploying and Decommissioning VMs but we're having trouble authenticating. The question is: For Ansible, does it use a connection directly to the Master Hypervisor, (XCP Server) or to XO?
It appears the XENAPI is more complete as well, but looks like connection to the XCP server is necessary for that.
Any removal of the fog on my end would be appreciated, as I don't profess to be an API or Ansible expert.
-
@hcoles I did find that in the first set of docs it points to xenserver or XCP host.
That said, how would I setup an account to be used for the purpose so that we're not using "root" as that would flag on audits.
-
Hi,
The xenserver ansible module isn't what you seek. It's better to use XO modules, as it's the central point and a lot safer to use at scale than storing all XCP-ng creds for all your hosts.
If there's missing bits in the providers you need, we'll be happy to help you contribute (ie doing issues and explain what's missing and even maybe if you can improve it directly via a pull request)
edit: the first link you posted is for XenServer, not XCP-ng
-
@olivierlambert That module/plugin looks to only be for inventory, I need to be able to deploy VMs, decom, modify, etc. Did I miss something in the docs?
I'm not a developer, and I need to find a way to use Ansible to automate VM setup and take down. We're currently in POC mode for XCP, but we're finding it coming up short in Automation (or docs about it).
The xenserver one is documented to be tested with XCP, and was I was directed to when searching for what I need.
-
For now, this is done with Packer+Terraform. We have plans to do also the same for Ansible (which is indeed only inventory for now).
You can use the XS ansible module, but it is not maintained. Maybe that would be enough until we got the module for XO API
-
@olivierlambert Well, Thanks for the info, we'll have to look into that.
Terraform can use templates as well right? So, if we don't use packer for VMs we wouldn't necessarily have to in the future? -
Yes, you can use Terraform directly