Automating the Citrix World using Terraform, Ansible, and Packer (Part 3)

Running the first Ansible Playbooks on the Windows-based VMs directly from Ansible

In this part of the Citrix Automation series, we run the first Ansible Playbooks on the Windows-based VMs directly using Ansible:

  1. Joining the Virtual Machines to an Active Directory Domain
  2. Deploying and Configuring the Citrix Cloud Connector software on the Domain-joined VMs

Why should we use an Ansible Playbook for adding a VM to a Domain?

Not all Terraform providers offer the possibility of automatically joining a newly created VM to a Domain, so we decided to create a generic way using an Ansible Playbook.

Here is an example of the Ansible Playbook we use:

IMPORTANT: You must watch the correct indents the YAML syntax requires!

Running this playbook shows successful completion (the parameter -vvvv means a lot of verbose output – perfect for debugging!)

The errors for 172.31.4.18 occur, because this VM was not switched on while Ansible ran the playbook.

Ansible has successfully put the VM into the Active Directory Domain.
Now we can install the Cloud Connector software.

Installing the Citrix Cloud Connector software on the VMs

The Cloud Connector is a needed component for Citrix DaaS.
It handles all communications between the Resource Location and the Control Plane on Citrix Cloud.

It is an EXE file that needs a JSON-based configuration file.

The EXE is downloaded from an Azure Storage Location after the creation of the VM by Terraform.

The JSON file depends on various configuration steps done during the deployment.
It is dynamically created by Terraform and also uploaded after VM creation in the correct folder required by the Playbook.

Example of the JSON-based configuration file:

This file is saved in the same directory as the cwcconnector.exe.

Running the Ansible Playbook installs the Cloud Connector and puts it into the needed Resource Location.

Here is an example of the Ansible Playbook we use:

IMPORTANT: You must watch the correct indents the YAML syntax requires!

Running this playbook shows successful completion:

The errors for 172.31.4.18 occur, because this VM was not switched on while Ansible ran the playbook.

Ansible has successfully configured the Cloud Connector and registered it in the Resource Location.

In the next part, we will run the Ansible Playbooks directly out of Terraform.