vRA, where is my template?

So, you’ve automated everything related to your template creation. You use packer like a boss as part of your CI/CD toolchain. They’re automatically placed onto your vmware environment and you wait for a mystical event to occur where the templates become available to vRA so you can use them in blueprints…. you sigh

Yes, you know you can set the refresh for the inventory to an hour ….. an hour… OMG you’ll be watching cat videos and forget what you’re doing before that happens.

Yes, you also know that you can navigate the clicky clicky world of vRA and refresh the inventory on demand as part of the data collection tasks. Sadly Jenkins is a little unwilling to clicky click and demands programmatic access (I know the REST api would be better for this use case, please humour me).

Well, Cloudclient comes to the rescue. In a previous post I introduced you to Cloudclient, a CLI interface to vRA.

The thing to note here is that the compute resources are managed by the IaaS servers and not the vRA appliance itself. Since you’ll be asking the IaaS server to do something (refresh the inventory) you’ll need to ensure your Cloudclient session is logged into the IaaS infrastructure.

1vra login iaas --server {iaas-server-vip} --domain {domain} --user {user} --password {password}
1vra computeresource list
1vra computeresource datacollection start --name {resource-name} --waitforcompletion yes

You’re a wizard!