Hi there,
New to the forum and chiming in to share an Ansible collection for Citrix Virtual Apps and Desktops, which I put together in my spare time.
This is my first ever collection, so I’m mostly looking for feedback on how to improve it, any tips are very welcome!
I realize it’s a pretty niche scenario, but hope that someone can still look at my code and provide feedback without having a test setup
What problem does it solve?
Allow you to use ansible modules instead of uri modules to put a Citrix machine in maintenance mode or add one to a delivery group.
CVAD has a REST API, we could use ansible’s uri module to fetch a bearer token, store that in a temporary variable and then do the actual request, it seemed like a good idea to abstract this away into a custom module, making it simpler to use as well as let me learn how to create custom ansible modules. ![]()
What’s included in the collection?
Full collection can be found on ansible galaxy: nbeernink.cvad
At the time of writing, it includes the following Ansible modules:
machine_info - returns info for a given machine
delivery_group_info - returns info for a delivery group
delivery_group_machines - assigns/removes machines in a delivery group
machine_catalog_info - returns info for a machine catalog
machine_maintenancemode - allows turning on/off maintenance mode for a machine
I also plan to add a custom inventory plug-in at some point, which would allow you to point ansible to a Citrix delivery controller and target all machines in a specific delivery or machine catalog as well as generate groups based on citrix tags.
Background
Little bit of background story on this:
At my day job, we have been using Citrix in a disconnected environment for at least 8 years, running a farm of (~1500+) assigned/persistent Red Hat Enterprise Linux workstations with Citrix’ Linux VDA installed. The machines are provisioned using an Ansible playbook and then added to the machine catalogs and delivery groups.
During maintenance on these machines, for example to update the VDA rpm, we would power them on to do maintenance and then found out that due to our power schedule the delivery controller would power them off again. At that point in time we didn’t have access to a “proper API” and had to resort to using powershell to put machines in maintenance mode, however that doesn’t have great error handling.
I contacted Citrix support to request a similar collection of ansible modules, however they pointed me towards their terraform plugin. As we aren’t using terraform (yet) this wasn’t a road we were prepared to go down.
The collection is not perfect (yet), but at least it’s a start ![]()