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

Creating an Ubuntu-based VM as the Citrix Automation Hub

In this first part of the Citrix Automation series, let´s create an Ubuntu-based VM on Azure with Terraform, Ansible, and Packer installed.

We will use Microsoft Visual Studio Code as a GUI-based tool for writing the code snippets and a standard SSH-based client for writing Terminal-based code.

The planned Citrix Automation deployment will be fully Azure-based using a separate Resource Group.
The Ubuntu-based VM will be the central hub and repository for all code snippets and Automation frameworks installed on the same VM.

Installing an Ubuntu-based VM on Azure

The main part of our Automation environment is the Ubuntu-based VM with all installed Automation frameworks on it.
Therefore we chose a Standard D2dsv5-based Azure VM – the Dadsv5-series VMs are based on the 3rd Generation AMD EPYC™ 7763v (Milan) processor with local temporary storage.
The installed OS is Ubuntu 24.04 LTS – I took the standard Marketplace Image without a GUI – the GUI and RDP were installed later…

The deployment of the Azure-based VM was straightforward.
After the completion of the installation, we added the following packages:

  1. For GUI: xfce4
  2. For RDP: xrdp
  3. For IaC: Terraform
  4. For Image Management: Packer
  5. For Image configuration: Ansible
  6. For Code writing: Microsoft Visual Studio Code

XRDP is working:

Let´s look at the installed versions of the installed Automation frameworks:

Let´s start Visual Studio Code to initialize it:

Now, the main packages are installed – let´s look at the installed Ansible modules:

The latter most important module “microsoft.ad” is installed out-of-the-box, so there is currently no need to install additional Ansible modules.

As we will mostly configure Windows-based VMs, we need to install Kerberos- and WinRM-related packages, especially pipx and pywinrm – the latter enables Ubuntu to connect to Windows-based VMs using WinRM

We will discuss the detailed WinRM-configuration of the Windows-based VMs in Part 2…

Now all needed packages for the initial Automation deployments have been installed.

Configuring Ansible

The first step is to configure the /etc/ansible/hosts file of Ansible:
Grouping hosts in different groups allows applying different configurations when running the Ansible Playbooks.

In this example, we create 3 groups – hosts based on IP addresses, based on Server names, and based on FQDNs.

Further, we can define the WinRM configuration for each group – Ansible needs to know how to connect to the respective servers:

GNU nano 7.2          /etc/ansible/hosts  
                                                                     
[cloudconnectors-ip]
172.31.4.17
172.31.4.18

[cloudconnectors-nb]
TMM-GK-W2K22-N1
TMM-GK-W2K22-N2

[cloudconnectors-dns]
TMM-GK-W2K22-N1.az.the-austrian-citrix-guy.at
TMM-GK-W2K22-N2.az.the-austrian-citrix-guy.at

[cloudconnectors-ip:vars]
ansible_user=tmm-azxXxXx
ansible_password="!xXxXxXxXxXxXx!Ab2023!1!!"
ansible_port=5986
ansible_connection=winrm
ansible_winrm_scheme=https
ansible_winrm_server_cert_validation=ignore
ansible_winrm_kerberos_delegation=true

[cloudconnectors-nb:vars]
ansible_user=tmm-azxXxXx
ansible_password="xXxXxXxXxXxXx"
ansible_port=5986
ansible_connection=winrm
ansible_winrm_scheme=https
ansible_winrm_server_cert_validation=ignore
ansible_winrm_kerberos_delegation=true

[cloudconnectors-dns:vars]
ansible_user="tmm-azxXxXx@xXx.the-austrian-citrix-guy.at"
ansible_password="xXxXxXxXxXxXx"
ansible_port=5986
ansible_connection=winrm
ansible_winrm_scheme=https
ansible_winrm_server_cert_validation=ignore
ansible_winrm_kerberos_delegation=true

Ansible is now ready to use.
That concludes Part 1 of our Citrix Automation series.

In the next part, we will discuss the deployment and initial configuration of Windows-based VMs – in particular the configuration of WinRM.