Skip to content
Ansible modules for Citrix NetScaler
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
ansible-modules Update citrix_adc_nitro_request documentation to explain changed status Feb 28, 2019
ansible-plugins Add ssh_citrix_adc connection plugin and documentation Feb 25, 2019
deps Added appfw prerequisite files and a script w… Nov 6, 2018
samples Add nscli shell command example Feb 28, 2019
test Update top level integration test playbook for appfw modules Oct 5, 2018
utils Update documentation generation scripts and templates Dec 10, 2018
.gitignore Added .gitignore May 26, 2017
Makefile Modify Makefile Jan 18, 2018 Add ssh_citrix_adc connection plugin and documentation Feb 25, 2019 Update issues Nov 21, 2018 Fix whitespace in load tests script May 12, 2017
requirements.test.txt Changes to the top level run tests script Apr 27, 2017

Citrix ADC & Citrix ADM Ansible modules

This repository provides Ansible modules for configuring Citrix NetScaler instances. It uses the NITRO REST API. All form factors of Citrix NetScaler are supported.

The code here should be considered alpha quality and may be broken at times due to experiments and refactoring. Tagged releases should be stable. The most stable version will be availble with Ansible automatically.

Module renaming

Note that as of this commit all modules were renamed to match the new Citrix product names.

See here for reference.

All modules which previously started with the netscaler_ prefix have been renamed to to start with the citrix_adc_ prefix.

All new modules will follow this convention as well.

Until these changes are integrated into the Ansible distribution the Citrix ADC module names will differ depending on where they were installed from.


Documentation is hosted at readthedocs.

Currently the following modules are implemented

  • citrix_adc_appfw_confidfield - Configuration for configured confidential form fields resource
  • citrix_adc_appfw_fieldtype - Configuration for application firewall form field type resource
  • citrix_adc_appfw_global_bindings - Define global bindings for AppFW
  • citrix_adc_appfw_htmlerrorpage - Configuration for configured confidential form fields resource
  • citrix_adc_appfw_jsoncontenttype - Configuration for JSON content type resource
  • citrix_adc_appfw_learningsettings - Configuration for learning settings resource
  • citrix_adc_appfw_policy - Manage Netscaler Web Application Firewall policies
  • citrix_adc_appfw_policylabel - Manage Netscaler Web Application Firewall policy labels
  • citrix_adc_appfw_profile - Manage Netscaler Web Application Firewall profiles
  • citrix_adc_appfw_settings - Manage Netscaler Web Application Firewall settings
  • citrix_adc_appfw_signatures - Configuration for configured confidential form fields resource
  • citrix_adc_appfw_wsdl - Configuration for configured confidential form fields resource
  • citrix_adc_appfw_xmlcontenttype - Configuration for XML Content type resource
  • citrix_adc_appfw_xmlerrorpage - Configuration for configured confidential form fields resource
  • citrix_adc_appfw_xmlschema - Configuration for configured confidential form fields resource
  • citrix_adc_cs_action - Manage content switching actions
  • citrix_adc_cs_policy - Manage content switching policy
  • citrix_adc_cs_vserver - Manage content switching vserver
  • citrix_adc_gslb_service - Manage gslb service entities in Netscaler
  • citrix_adc_gslb_site - Manage gslb site entities in Netscaler
  • citrix_adc_gslb_vserver - Configure gslb vserver entities in Netscaler
  • citrix_adc_lb_monitor - Manage load balancing monitors
  • citrix_adc_lb_vserver - Manage load balancing vserver configuration
  • citrix_adc_nitro_request - Issue Nitro API requests to a Netscaler instance
  • citrix_adc_save_config - Save Netscaler configuration
  • citrix_adc_server - Manage server configuration
  • citrix_adc_service - Manage service configuration in Netscaler
  • citrix_adc_servicegroup - Manage service group configuration in Netscaler
  • citrix_adc_ssl_certkey - Manage ssl cerificate keys
  • citrix_adm_application - Manage applications on Citrix ADM
  • citrix_adm_dns_domain_entry - Manage Citrix ADM domain names
  • citrix_adm_login - Login to a Citrix ADM instance
  • citrix_adm_mpsgroup - Manage Citrix ADM user groups
  • citrix_adm_mpsuser - Manage Citrix ADM users
  • citrix_adm_ns_facts - Retrieve facts about Citrix ADM managed instances
  • citrix_adm_poll_instances - Force the poll instances network function on the target Citrix ADM
  • citrix_adm_rba_policy - Manage Citrix ADM rba policies
  • citrix_adm_rba_role - Manage Citrix ADM rba roles
  • citrix_adm_stylebook - Create or delete Citrix ADM stylebooks
  • citrix_adm_tenant_facts - Retrieve facts about Citrix ADM tenants



Using virtualenv (recommended)

Use of a python virtualenv during installation is recommended.

  • Activate the virtualenv (source bin/activate)
  • Install all dependencies by running pip install -r requirements.test.txt from the project checkout.
  • Install the netscaler modules using python

Global install

  • Install Ansible (sudo pip install ansible)
  • Install NetScaler SDK (pip install deps/nitro-python-1.0_kamet.tar.gz)
  • Install NetScaler modules (sudo python It tries to find the ansible installation directory and then copies the module files to the appropriate places.

If the ansible installation is on a dirctory that requires root access, the install script should be run with root privileges. If the isntallation script fails and you know where ansible is located on your system you can do a manual installation. Just copy the contents of the ansible-modules directory to the extras module directory and the file to the module_utils directory of ansible.

Backport for Ansible 2.4.x

The modules are developed against the latest development version of ansible.

Some changes made by the core ansible developers caused the modules to lose backwards portability to ansible 2.4.

If you need the latest version of the modules present in this repository and are restricted to using ansible 2.4 you can use the backport branch backport_2.4 which contains the fixes needed for the modules to run under ansible 2.4 while also containing the latest changes.

This branch will be kept up to date with the master branch.


All modules are intended to be run on the ansible control machine or a jumpserver with access to the Citrix NetScaler appliance. To do this you need to use the local_action or the delegate_to options in your playbooks.

There are sample playbooks in the samples directory.

Detailed documentation for each module can be found in the htmldoc directory.

Documentation regarding the Citrix NetScaler appliance configuration in general can be found at the following link,

MAS proxied calls

There is also the ability to proxy module NITRO calls through a MAS to a target Netscaler.

In order to do that you need a NITRO Python SDK that has the MAS proxy calls capability and also follow these 2 steps.

  1. First acquire a nitro authentication token with the use of the netscaler_nitro_request mas_login operation.
  2. Next all subsequent module invocations should have the mas_proxy_call option set to true , replace the nitro_user and nitro_pass authentication options with the nitro_auth_token acquired from the previous step and finally include the instance_ip option to instruct MAS to which netscaler to proxy the calls.

A sample playbook is provided in the samples directory. mas_proxied_server.yaml

Citrix ADC connection plugin

The Citrix ADC connection plugin allows the use of standard Ansible modules, such as shell and fetch, with Citrix ADC.


The installation script provided here will install the plugin to the ansible path inside the standard Ansible connection plugin directory.

You can also manually copy the connection plugin source file located in ansible-plugin/ssh\_citrix\ to a custom location that Ansible will search for it. Refer to the Ansible documentation for details.


In order for a standard Ansible module to work properly with the Citrix ADC connection plugin the following conditions must hold true.

  • Modify the playbook so that it uses the connection plugin (connection: ssh_citrix_adc).
  • Citrix ADC does not have the python interpreter path defined, so one should pass this path when defining the host group (ansible_python_interpreter: /var/python/bin/python).
  • The plugin works only with ssh key based authentication. The remote Citrix ADC must have the public ssh key of the controlling machine in their authorized_keys file (/flash/nsconfig/ssh/authorized_keys).
  • In the local ansible.cfg file make sure the following lines exist:
host_key_checking = False

scp_if_ssh = True

You can find usage samples in this folder.

Citrix ADC and standard Ansible modules in a single playbook

There are some conflicting configuration options when using a standard Ansible module with a Citrix ADC specific module in the same playbook.

To have such a playbook execute correctly the following solutions are proposed.

  • Have a single playbook with multiple plays ( sample ).
  • Have a single play configured for standard Ansible modules and define the neeeded overrides in the Citrix ADC specific tasks ( sample ).
  • Have a single play configured for Citrix ADC specific modules and define the needed overrides for the generic Ansible tasks ( sample ).

Directory structure

  • ansible-modules. Contains all the ansible modules available. These are the files that must be installed on an ansible control node in order for the functionality to be present

  • ansible-plugins. Contains all the ansible plugins available.

  • tests. Contains the test suite for the modules. It requires some extra dependencies than the plain modules in order to run.

  • samples. Contains some sample playbooks that combine more than one modules together to achieve a desired configuration. Examples of the modules' usage are also contained in the EXAMPLES section of the modules themselves.

  • htmldoc. Contains the html documentation for each module.

  • utils. Contains utilities mainly used for the authoring of the modules and are not relevant to the end user.

  • documentation_fragments. Contains the Citrix NetScaler specific documentation files for ansible.

  • Top level script to run all the tests.






Pull requests and issues are welcome.

You can’t perform that action at this time.