Ansible template for provisioning

I am trying to deploy a new vm on a xen hypervisor. I have the compute resource and profiles configured, and I have host groups setup with activation keys. Manual deployments go fine, but when I try with ansible I get an error:

"errors": {
"base": [
"Failed to create a compute xenhost01 (Xenserver) instance Template not found\n "

I tried a couple of things, first I used the host_info module on an existing host in the hopes it would show me which template was used so I could copy/paste that info but alas, it wasn’t that simple.

I used -vvv to show extra info. It shows me the invocation with all the settings including those that are ‘null’, but template is not shown.

Lastly, I tried to guess. I know how to specify templates on RHV or Ovirt, so I tried to specify it in a similar way like this:

  template: "Rocky Linux 8"

I tried other names but I could sit here all day guessing, figured I’d ask if anyone has some tips on how I can figure out how to specify a template.


Compute resources API is not in a great shape. It needs some work unfortunately.

Im not sure what that means for me. Are you saying what I want is not possible?

It means you might need to go deeper into this.

If you use Ansible to provision instances in cloud via Foreman, I would suggest to use Ansible directly with cloud avoiding Foreman but configuring our images to use Foremans cloud init template to register those hosts into Foreman as they launch.

1 Like