How Ansible automate Citrix Virtual Apps and Desktops 2212 installations

You want to install your lab or production environment or have to do that many times? You have to install Citrix backend components? Here you can see, how to automate Citrix Virtual Apps and Desktops installation. You will learn what is Ansible is and how you can setup your Citrix Controller in minutes. In my Github Repository for Ansible Roles, you can find the hole deployment für a home lab environment. You can deploy VMs, configure your Active Directory and install your Citrix components.

Ansible? What is this?

Ansible is a widely used tool for automating IT projects. It is based on the YAML format and is controlled through a commandline or web-based UI (Graphical User Interface) via AWX, for example. Ansible can either be used for “one shot deployments or configurations” or permanently ensure that the environment maintains the defined state.

Ansible can perform various actions, such as installations of software, configurations of devices or databases, and much more. It is very flexible and can be started using immediately. Ansible is open source software, which is released under the GNU Lesser General Public License (LGPL).

Ansible has a number of advantages over other automation systems, including the fact that it does not require agents and therefore does not require administrative access to the systems. Ansible is also very easy to install and use.

By using the right playbook, instruction files can be created that will guide even inexperienced users to control the controller and make everything go quite easily.

If you want to see, how to setup Ansible in different ways to start deploying your environment, please check out my articles about this topics.

Ansilbe on Microsoft WSL you will find more by using the search of my website.

Why automate Citrix Virtual Apps and Desktops installation?

If you have to install environments more than once to test them, this can be very tedious and time-consuming. The same applies if you want to perform the same installation over and over again, for example. For example, for several customers. The advantage of this is that if you automate the installation, the same result will always come out. It is also much easier to rebuild or extend the environment.

Requirements

First of all, you have to install ansible. And you have to download the Github repository.

https://github.com/thomaspreischl/Ansible_Roles
In my Github repository you will find a readmy with examples to each playbook and roles. If you miss something, please give my a hind or feel free to contribute my repository.

If you allready have an environment and want to use existing Windows Servers to do an installation of roles. Please execute the following script:
https://github.com/thomaspreischl/Ansible_Roles/blob/main/prep_Windows_for_ansible/ConfigureRemotingForAnsible.ps1

This script is prepairing your os to communicate correctly with Ansible.

Automate Citrix Virtual Apps and Desktops – getting started

If have done this, please edit inventory and group_vars file to fit your environment. Here you can define everything you need. Logins to your environment, IP Addresses, where to install which role and configuration. This information is extremely important that we can automate Citrix Virtual Apps and Desktops in our environment.

Good to Know

If you create a copy of the inventory file, you also have to create a copy of your group_vars file.

Here you can see how the dependency of inventory and playbook are related.

What we will do in this playbook?

Here you can see how the playbook is built. there are some additional roles executed that I need in my environment. You can of course comment out or remove or add from roles.

playbook:

---

# you can also copy a section, make a new group in your environment and install roles more seperated

 #Install Citrix Virtual Apps and Desktop Controller
- name: Install Citrix Virtual Apps and Desktop Controller full without storefront
  hosts: ctxcontroller
  vars_files:
    - ./vars/ctx/2209.yml
  vars:
    components: CONTROLLER,DESKTOPSTUDIO,DESKTOPDIRECTOR,LICENSESERVER 
  gather_facts: yes
  roles:
    - win-disable-ieesec
    - win-disable-ipv6
    - ctx-install-management-components


- name: Install Citrix Storefront
  hosts: ctxstorefront
  vars_files:
    - ./vars/ctx/2209.yml 
  gather_facts: yes
  roles:
    - win-disable-ieesec
    - win-disable-ipv6
    - ctx-install-storefront


 #Install MS SQL Express Server and Management Studio
- name: Install MS SQL Express Server 2017 and Management Studio
  hosts: sqlexpress
  gather_facts: yes
  roles:
    - win-disable-ieesec
    - win-disable-ipv6
    - ms-install-sql-express2017
    - ms-install-sql-mgmtstudio

variables:

You have to define a view variables before we can start.

# Define your Active Directory Groups here


# edition: 2103

#path, where your iso is stored 
srcisofile: /mnt/d/Downloads_LAB/ctx/Citrix_Virtual_Apps_and_Desktops_7_2209.iso

#path where to copy the iso and pick it to mount and install on the target system
destisofile: C:\ansible_install\Citrix_Virtual_Apps_and_Desktops_7_2209.iso

req_roles: NET-Framework-45-Core,GPMC,RSAT-ADDS-Tools,RDS-Licensing-UI,WAS,Telnet-Client
    

exepath: '{{ disk_image_out.mount_paths[0] }}x64\XenDesktop Setup\XenDesktopServerSetup.exe'

sfexepath: '{{ disk_image_out.mount_paths[0] }}x64\Storefront\CitrixStoreFront-x64.exe'
sfproductid: '{AE4B5815-02D8-4AF4-8B3A-581CD511443A}'

#if components are not defined in playbook, use this
components: 'CONTROLLER,DESKTOPSTUDIO,DESKTOPDIRECTOR,LICENSESERVER'

params_full: '/COMPONENTS {{ components }} /CONFIGURE_FIREWALL /QUIET /NOREBOOT /NOSQL /ignore_hw_check_failure'
    

Let us do some magic

If you have defined your environment variables.

You can run your script by using the following command: ansible-playbook citrix_roles_2209.yml -i ./inventory/homelab

automate Citrix Virtual Apps and Desktops

Here you can see the running playbook

automate Citrix Virtual Apps and Desktops

For more information you can also read the description of the role and playbook examples on my Github.
https://github.com/thomaspreischl/Ansible_Roles/tree/main/roles/ctx-install-management-components

Conclusion

So as you can see, it makes sense to get more involved with the topic of automation. And it is very easy to automate Citrix Virtual Apps and Desktops with Ansible. If you liked this article, please share it and follow me on twitter @thomaspreischl

Leave a Comment

Your email address will not be published. Required fields are marked *