community.network.netscaler_nitro_request module – Issue Nitro API requests to a Netscaler instance.
Note
This module is part of the community.network collection (version 5.1.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.network.
To use it in a playbook, specify: community.network.netscaler_nitro_request.
Note
The community.network collection has been deprecated and will be removed from Ansible 12. See the discussion thread for more information.
DEPRECATED
- Removed in:
- version 6.0.0 
- Why:
- This collection and all content in it is unmaintained and deprecated. 
- Alternative:
- Unknown. 
Synopsis
- Issue Nitro API requests to a Netscaler instance. 
- This is intended to be a short hand for using the uri Ansible module to issue the raw HTTP requests directly. 
- It provides consistent return values and has no other dependencies apart from the base Ansible runtime environment. 
- This module is intended to run either on the Ansible control node or a bastion (jumpserver) with access to the actual Netscaler instance 
Aliases: network.netscaler.netscaler_nitro_request
Parameters
| Parameter | Comments | 
|---|---|
| The action to perform when the operation value is set to  Some common values for this parameter are  | |
| A dictionary which defines the key arguments by which we will select the Nitro object to operate on. It is required for the following operation values:  | |
| The attributes of the Nitro object we are operating on. It is required for the following operation values:  | |
| A list of numeric values that signify that the operation was successful. Default:  | |
| A dictionary which defines the filter with which to refine the Nitro objects returned by the  | |
| The id of the target Netscaler instance when issuing a Nitro request through a MAS proxy. | |
| The IP address of the target Netscaler instance when issuing a Nitro request through a MAS proxy. | |
| The name of the target Netscaler instance when issuing a Nitro request through a MAS proxy. | |
| The name of the resource we are operating on. It is required for the following operation values:  | |
| The authentication token provided by the  | |
| The password with which to authenticate to the Netscaler node. | |
| Which protocol to use when accessing the Nitro API objects. Choices: 
 | |
| The username with which to authenticate to the Netscaler node. | |
| The IP address of the Netscaler or MAS instance where the Nitro API calls will be made. The port can be specified with the colon  | |
| Define the Nitro operation that we want to perform. Choices: 
 | |
| The type of resource we are operating on. It is required for all operation values except  | |
| If  Choices: 
 | 
Examples
- name: Add a server
  delegate_to: localhost
  community.network.netscaler_nitro_request:
    nsip: "{{ nsip }}"
    nitro_user: "{{ nitro_user }}"
    nitro_pass: "{{ nitro_pass }}"
    operation: add
    resource: server
    name: test-server-1
    attributes:
      name: test-server-1
      ipaddress: 192.168.1.1
- name: Update server
  delegate_to: localhost
  community.network.netscaler_nitro_request:
    nsip: "{{ nsip }}"
    nitro_user: "{{ nitro_user }}"
    nitro_pass: "{{ nitro_pass }}"
    operation: update
    resource: server
    name: test-server-1
    attributes:
      name: test-server-1
      ipaddress: 192.168.1.2
- name: Get server
  delegate_to: localhost
  register: result
  community.network.netscaler_nitro_request:
    nsip: "{{ nsip }}"
    nitro_user: "{{ nitro_user }}"
    nitro_pass: "{{ nitro_pass }}"
    operation: get
    resource: server
    name: test-server-1
- name: Delete server
  delegate_to: localhost
  register: result
  community.network.netscaler_nitro_request:
    nsip: "{{ nsip }}"
    nitro_user: "{{ nitro_user }}"
    nitro_pass: "{{ nitro_pass }}"
    operation: delete
    resource: server
    name: test-server-1
- name: Rename server
  delegate_to: localhost
  community.network.netscaler_nitro_request:
    nsip: "{{ nsip }}"
    nitro_user: "{{ nitro_user }}"
    nitro_pass: "{{ nitro_pass }}"
    operation: action
    action: rename
    resource: server
    attributes:
      name: test-server-1
      newname: test-server-2
- name: Get server by args
  delegate_to: localhost
  register: result
  community.network.netscaler_nitro_request:
    nsip: "{{ nsip }}"
    nitro_user: "{{ nitro_user }}"
    nitro_pass: "{{ nitro_pass }}"
    operation: get_by_args
    resource: server
    args:
      name: test-server-1
- name: Get server by filter
  delegate_to: localhost
  register: result
  community.network.netscaler_nitro_request:
    nsip: "{{ nsip }}"
    nitro_user: "{{ nitro_user }}"
    nitro_pass: "{{ nitro_pass }}"
    operation: get_filtered
    resource: server
    filter:
      ipaddress: 192.168.1.2
# Doing a NITRO request through MAS.
# Requires to have an authentication token from the mas_login and used as the nitro_auth_token parameter
# Also nsip is the MAS address and the target Netscaler IP must be defined with instance_ip
# The rest of the task arguments remain the same as when issuing the NITRO request directly to a Netscaler instance.
- name: Do mas login
  delegate_to: localhost
  register: login_result
  community.network.netscaler_nitro_request:
    nsip: "{{ mas_ip }}"
    nitro_user: "{{ nitro_user }}"
    nitro_pass: "{{ nitro_pass }}"
    operation: mas_login
- name: Add resource through MAS proxy
  delegate_to: localhost
  community.network.netscaler_nitro_request:
    nsip: "{{ mas_ip }}"
    nitro_auth_token: "{{ login_result.nitro_auth_token }}"
    instance_ip: "{{ nsip }}"
    operation: add
    resource: server
    name: test-server-1
    attributes:
      name: test-server-1
      ipaddress: 192.168.1.7
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| A string with the actual HTTP response body content if existent. If there is no HTTP response body it is an empty string. Returned: always Sample:  | |
| A dictionary that contains all the HTTP response’s data. Returned: always Sample:  | |
| The token returned by the  Returned: when applicable Sample:  | |
| A numeric value containing the return code of the NITRO operation. When 0 the operation is successful. Any non zero value indicates an error. Returned: always Sample:  | |
| A string containing a human readable explanation for the NITRO operation result. Returned: always Sample:  | |
| The object returned from the NITRO operation. This is applicable to the various get operations which return an object. Returned: when applicable Sample:  | |
| A string describing the severity of the NITRO operation error or NONE. Returned: always Sample:  | 
Status
- This module will be removed in version 6.0.0. [deprecated] 
- For more information see DEPRECATED. 
