netscaler_cs_policy – Manage content switching policy — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# netscaler_cs_policy – Manage content switching policy

New in version 2.4.

- Synopsis
- Requirements
- Parameters
- Notes
- Examples
- Return Values
- Status

## Synopsis

- Manage content switching policy.
- This module is intended to run either on the ansible control node or a bastion (jumpserver) with access to the actual netscaler instance.

## Requirements

The below requirements are needed on the host that executes this module.

- nitro python sdk

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
action - |  | Content switching action that names the target load balancing virtual server to which the traffic is switched.
domain - |  | The domain name. The string value can range to 63 characters. Minimum length = 1
nitro_pass string / required |  | The password with which to authenticate to the netscaler node.
nitro_protocol string | Choices: http ← https | Which protocol to use when accessing the nitro API objects.
nitro_timeout float | Default: 310 | Time in seconds until a timeout error is thrown when establishing a new session with Netscaler
nitro_user string / required |  | The username with which to authenticate to the netscaler node.
nsip string / required |  | The ip address of the netscaler appliance where the nitro API calls will be made. The port can be specified with the colon (:). E.g. 192.168.1.1:555.
policyname - |  | Name for the content switching policy. Must begin with an ASCII alphanumeric or underscore `_` character, and must contain only ASCII alphanumeric, underscore, hash `#`, period `.`, space `` , colon `:`, at sign `@`, equal sign `=`, and hyphen `-` characters. Cannot be changed after a policy is created. The following requirement applies only to the NetScaler CLI: If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, my policy or my policy). Minimum length = 1
rule - |  | Expression, or name of a named expression, against which traffic is evaluated. Written in the classic or default syntax. Note: Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"<string of 255 characters>" + "<string of 245 characters>"'
save_config boolean | Choices: no yes ← | If `yes` the module will save the configuration on the netscaler node if it makes any changes. The module will not save the configuration on the netscaler node if it made no changes.
state string | Choices: absent present ← | The state of the resource being configured by the module on the netscaler node. When present the resource will be created if needed and configured according to the module's parameters. When absent the resource will be deleted from the netscaler node.
url - |  | URL string that is matched with the URL of a request. Can contain a wildcard character. Specify the string value in the following format: `[[prefix] [*]] [.suffix]`. Minimum length = 1 Maximum length = 208
validate_certs boolean | Choices: no yes ← | If `no`, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.

## Notes

Note

- For more information on using Ansible to manage Citrix NetScaler Network devices see https://www.ansible.com/ansible-netscaler.

## Examples

    - name: Create url cs policy
      delegate_to: localhost
      netscaler_cs_policy:
        nsip: 172.18.0.2
        nitro_user: nsroot
        nitro_pass: nsroot
        validate_certs: no

        state: present

        policyname: policy_1
        url: /example/

## Return Values

Common return values are documented here, the following are the fields unique to this module:

Key | Returned | Description
--- | --- | ---
diff dictionary | failure | List of differences between the actual configured object and the configuration specified in the module Sample: {'url': 'difference. ours: (str) example1 other: (str) /example1'}
loglines list | always | list of logged messages by the module Sample: ['message 1', 'message 2']
msg string | failure | Message detailing the failure reason Sample: Could not load nitro python sdk

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- George Nikolopoulos (@giorgos-nikolopoulos)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.