|
1 | | -# NetScaler Ansible Collection `version2` - netscaler.adc |
| 1 | +# NetScaler ADC Collection |
2 | 2 |
|
3 | | -[](https://github.com/netscaler/ansible-collection-netscaleradc/actions) |
4 | | -[](https://github.com/netscaler/ansible-collection-netscaleradc/actions) |
5 | | -[](https://github.com/netscaler/ansible-collection-netscaleradc/actions) |
6 | | -[](https://github.com/netscaler/ansible-collection-netscaleradc/actions) |
7 | | -[](https://securityscorecards.dev/viewer/?uri=github.com/netscaler/ansible-collection-netscaleradc) |
| 3 | +## Description |
8 | 4 |
|
9 | | -> ⚠️ Note: |
10 | | -> The earlier `citrix.adc` ansible collection is replaced with the new `netscaler.adc` ansible collection. |
| 5 | +The collection provides Ansible modules to configure and manage NetScaler ADC appliances. The modules are written using the [NITRO API](https://developer-docs.netscaler.com/en-us/adc-nitro-api/current-release.html). The modules are idempotent and can be used to configure the NetScaler ADC appliances in a declarative manner. |
11 | 6 |
|
12 | | -> The `citrix.adc` ansible collection is backed up by a separate branch [citrix.adc](https://github.com/netscaler/ansible-collection-netscaleradc/tree/citrix.adc) |
13 | 7 |
|
| 8 | +## Requirements |
14 | 9 |
|
15 | | -## Vision |
| 10 | +### Ansible version compatibility |
16 | 11 |
|
17 | | -The vision of the `netscaler.adc` collection is to provide a complete declarative interface to configure and manage NetScaler ADC. |
| 12 | +Tested with Ansible Core >=2.15 versions. |
18 | 13 |
|
19 | | -If you need any feature or flexibility that is not available in the collection at the moment, please raise issues/enhancement-requests/recommendations at <https://github.com/netscaler/ansible-collection-netscaleradc/issues> |
| 14 | +### Python version compatibility |
20 | 15 |
|
21 | | -> :envelope: For any immediate issues or help , reach out to us at <[email protected]> ! |
22 | | -
|
23 | | -## About `version1` and `version2` of the collection |
24 | | - |
25 | | -We refer the earlier `citrix.adc` ansible collection as `version1` and the new `netscaler.adc` as `version2`. |
26 | | - |
27 | | -This is the `version2` of the NetScaler Ansible Collection. It is a complete rewrite of the collection. The collection is not backward compatible with the `version1` of the collection. |
28 | | - |
29 | | -`citrix.adc` collection will be deprecated soon and will not be maintained further. It is recommended to migrate to the `netscaler.adc` collection. |
30 | | - |
31 | | -## About the `netscaler.adc` collection (version2) |
32 | | - |
33 | | -The collection provides Ansible modules to configure and manage NetScaler ADC appliances. The modules are written using the NITRO API. The modules are idempotent and can be used to configure the NetScaler ADC appliances in declarative manner. |
| 16 | +Tested with Python >=3.11 |
34 | 17 |
|
35 | 18 | ## Installation |
36 | 19 |
|
37 | | -### ansible-galaxy |
| 20 | +### via Ansible-galaxy |
| 21 | + |
| 22 | +The netscaler.adc collection can be installed with the Ansible Galaxy command-line tool: |
38 | 23 |
|
39 | 24 | ```bash |
40 | 25 | ansible-galaxy collection install netscaler.adc |
41 | 26 | ``` |
42 | 27 |
|
43 | | -### via github (to have the latest updated which are yet to be released in ansible-galaxy) |
44 | | - |
| 28 | +### via Github (to have the latest updated which are yet to be released in ansible-galaxy) |
45 | 29 |
|
46 | 30 | ```bash |
47 | 31 | ansible-galaxy collection install "git+https://github.com/netscaler/ansible-collection-netscaleradc.git" [--force] |
48 | 32 | ``` |
49 | 33 |
|
50 | | -> `--force` option is required if you have already installed the collection via ansible-galaxy. This will overwrite the existing collection with the latest collection from github. |
| 34 | + > `--force` option is required if you have already installed the collection via ansible-galaxy. This will overwrite the existing collection with the latest collection from github. |
51 | 35 |
|
52 | | -### Verify the installation |
| 36 | +To verify the installation, run the following command: |
53 | 37 |
|
54 | 38 | ```bash |
55 | 39 | ansible-galaxy collection list netscaler.adc |
56 | 40 | ``` |
57 | 41 |
|
58 | | -The above command should display the following output: |
| 42 | +The above command should display the below output: |
59 | 43 |
|
60 | 44 | ```text |
61 | 45 |
|
62 | 46 | # /Users/netscaleruser/.ansible/collections/ansible_collections |
63 | 47 | Collection Version |
64 | 48 | ------------- ------- |
65 | | -netscaler.adc 2.0.x |
| 49 | +netscaler.adc 2.8.x |
| 50 | +``` |
| 51 | +## Usecases |
| 52 | + |
| 53 | +The modules can be called by their Fully Qualified Collection Name (FQCN) such as `netscaler.adc.lbvserver`, or by their short name `netscaler.adc` if the collection is listed under the playbook's `collections` attribute: |
| 54 | + |
| 55 | +### Usecase by FQCN |
| 56 | + |
| 57 | +```yaml |
| 58 | +--- |
| 59 | +- name: Sample lbvserver playbook |
| 60 | + hosts: demo_netscalers |
| 61 | + gather_facts: false |
| 62 | + tasks: |
| 63 | + - name: Configure lbvserver |
| 64 | + delegate_to: localhost |
| 65 | + netscaler.adc.lbvserver: |
| 66 | + nsip: "{{ nsip }}" |
| 67 | + nitro_user: "{{ nitro_user }}" |
| 68 | + nitro_pass: "{{ nitro_pass }}" |
| 69 | + nitro_protocol: "{{ nitro_protocol }}" |
| 70 | + validate_certs: false |
| 71 | + save_config: false |
| 72 | + state: present |
| 73 | + name: lb_dns_01 |
| 74 | + servicetype: HTTP |
66 | 75 | ``` |
67 | 76 |
|
68 | | -## Collection Modules Documentation |
69 | | - |
70 | | -<https://netscaler.github.io/ansible-collection-netscaleradc/> |
71 | | - |
72 | | -> You can also click on the desired module name in the [supported_modules_matrix.md](supported_modules_matrix.md) file to go to the specific module documentation |
73 | | -
|
74 | | -## Examples |
75 | | - |
76 | | -Refer to the [examples](examples) directory for the sample playbooks. |
77 | | - |
78 | | -Also refer [playbook_anatomy.md](playbook_anatomy.md) for the anatomy of a playbook. |
| 77 | +### Usecase by declaring collection |
| 78 | +
|
| 79 | +```yaml |
| 80 | +--- |
| 81 | +- name: Sample lbvserver playbook |
| 82 | + hosts: demo_netscalers |
| 83 | + gather_facts: false |
| 84 | + collections: |
| 85 | + - netscaler.adc |
| 86 | + tasks: |
| 87 | + - name: Configure lbvserver |
| 88 | + delegate_to: localhost |
| 89 | + lbvserver: |
| 90 | + nsip: "{{ nsip }}" |
| 91 | + nitro_user: "{{ nitro_user }}" |
| 92 | + nitro_pass: "{{ nitro_pass }}" |
| 93 | + nitro_protocol: "{{ nitro_protocol }}" |
| 94 | + validate_certs: false |
| 95 | + save_config: false |
| 96 | + name: lb_dns_01 |
| 97 | + servicetype: HTTP |
79 | 98 |
|
80 | | -## :key: Authentication |
| 99 | +``` |
81 | 100 |
|
82 | | -### Authenticate to NetScaler via username and password |
| 101 | +### Usecase by `netscaler.adc.module_default` group |
| 102 | + |
| 103 | +```yaml |
| 104 | +--- |
| 105 | +- name: Sample Playbook to use module_defaults to specify common arguments |
| 106 | + hosts: localhost |
| 107 | + gather_facts: false |
| 108 | + module_defaults: |
| 109 | + group/netscaler.adc.default_args: |
| 110 | + nsip: 10.10.10.10 |
| 111 | + nitro_user: nsroot |
| 112 | + nitro_pass: verysecretpassword |
| 113 | + nitro_protocol: http |
| 114 | + validate_certs: false |
| 115 | + save_config: false |
| 116 | + tasks: |
| 117 | + - name: Sample Task | ipset |
| 118 | + delegate_to: localhost |
| 119 | + netscaler.adc.lbvserver: |
| 120 | + name: lb_dns_01 |
| 121 | + servicetype: HTTP |
| 122 | +``` |
| 123 | +### NetScaler Console (ADM) as a Proxy Server |
83 | 124 |
|
84 | | -Every module in the collection requires the user to authenticate to the NetScaler ADC appliance. The authentication can be done using the `nitro_user` and `nitro_pass` parameters. These parameters can also be passed as environment variables `NETSCALER_NITRO_USER` and `NETSCALER_NITRO_PASS`. |
| 125 | +The collection supports configuring NetScaler Console as a proxy server. This is useful when you have multiple NetScaler ADC appliances and you want to manage them using a single NetScaler Console. |
85 | 126 |
|
86 | | -Refer to the [playbook_anatomy.md](playbook_anatomy.md) and [examples](examples) directory for the sample playbooks. |
| 127 | +An example can be found in [examples/netscaler_console_as_proxy_server.yaml](https://github.com/netscaler/ansible-collection-netscaleradc/blob/main/examples/netscaler_console_as_proxy_server.yaml). |
87 | 128 |
|
88 | | -### Authenticate to NetScaler |
| 129 | +Refer to the [NetScaler ADM as an API proxy server](https://docs.netscaler.com/en-us/netscaler-application-delivery-management-software/current-release/adm-as-api-proxy-server.html) for more details. |
89 | 130 |
|
90 | | -#### Password based authentication |
| 131 | +### Examples and playbook anatomy |
| 132 | +Refer to the [sample_playboook](https://github.com/netscaler/ansible-collection-netscaleradc/tree/main/examples) and [playbook_anatomy.md](https://github.com/netscaler/ansible-collection-netscaleradc/blob/main/playbook_anatomy.md). |
91 | 133 |
|
92 | | -Every task in the collection requires the user to authenticate to the NetScaler ADC appliance. The authentication can be done using the `nsip`, `nitro_user` and `nitro_pass` parameters. These parameters can also be passed as environment variables `NETSCALER_NSIP`, `NETSCALER_NITRO_USER` and `NETSCALER_NITRO_PASS`. |
93 | 134 |
|
94 | | -#### Using `netscaler.adc.module_defaults` group |
| 135 | +### SSH_connections |
95 | 136 |
|
96 | | -To avoid having to specify common parameters for all the modules in every task, you can use the `netscaler.adc.module_defaults` [module defaults](https://docs.ansible.com/ansible/devel/playbook_guide/playbooks_module_defaults.html#module-defaults-groups) group: |
| 137 | +Refer to [SSH_connections examples](https://github.com/netscaler/ansible-collection-netscaleradc/tree/main/examples/ssh_connections) to know how `ansible.builtins.` plugins can be used to configure the NetScaler ADC. |
97 | 138 |
|
98 | | -> Refer [examples/module_default_args_action_group.yaml](./examples/module_default_args_action_group.yaml) for an example playbook. |
| 139 | +### Authentication |
99 | 140 |
|
100 | | -#### Passwordless via `nitro_auth_token` parameter (SESSIONID based authentication) |
| 141 | +#### Authenticate to NetScaler via username and password |
101 | 142 |
|
102 | | -The collection also supports authentication to NetScaler ADC appliance via token. The token can be generated using the `login` module. The token can be passed to other modules using the `nitro_auth_token` parameter. The `nitro_token` parameter can also be passed as environment variable `NETSCALER_NITRO_AUTH_TOKEN`. |
| 143 | +Every module in the collection requires the user to authenticate to the NetScaler ADC appliance. To authenticate, provide the `nsip`, `nitro_user` and `nitro_pass` parameters directly or set them using environment variables `NETSCALER_NSIP`, `NETSCALER_NITRO_USER` and `NETSCALER_NITRO_PASS`. |
103 | 144 |
|
104 | | -Refer to the [playbook_anatomy.md](playbook_anatomy.md) and [sessionid_based_authentication_via_login_logout.yaml](examples/sessionid_based_authentication_via_login_logout.yaml) example playbook. |
| 145 | +Refer to the [playbook_anatomy.md](https://github.com/netscaler/ansible-collection-netscaleradc/blob/main/playbook_anatomy.md) and [sessionid_based_authentication_via_login_logout.yaml](https://github.com/netscaler/ansible-collection-netscaleradc/blob/main/examples/sessionid_based_authentication_via_login_logout.yaml) example playbook. |
105 | 146 |
|
106 | | -> `login` module requres `username` and `password` parameters to be passed. If you do not wish to pass the username and password, refer below. |
| 147 | +> `login` module requires `username` and `password` parameters to be passed. If you do not wish to pass the username and password, refer below. |
107 | 148 |
|
108 | 149 | You can use the below `curl` command to generate the token. The token can be passed to other modules using the `nitro_auth_token` parameter. The `nitro_auth_token` parameter can also be passed as environment variable `NETSCALER_NITRO_AUTH_TOKEN`. The token is valid for 60 minutes. |
109 | 150 |
|
110 | 151 | The below command also uses `jq` to parse the JSON output and store the `sessionid` in the `NETSCALER_NITRO_AUTH_TOKEN` environment variable, so that it can be used by other modules. |
111 | 152 |
|
112 | | -> change the `NETSCALER_NSIP`, `NETSCALER_NITRO_USER` and `NETSCALER_NITRO_PASS` |
113 | | -
|
114 | | -> Install `jq` util if not already installed. |
| 153 | +> Note: Change the `NETSCALER_NSIP`, `NETSCALER_NITRO_USER` and `NETSCALER_NITRO_PASS`. Install `jq` util if not already installed. |
115 | 154 |
|
116 | 155 | ```bash |
117 | 156 | export NETSCALER_NITRO_AUTH_TOKEN=$(curl -X POST -H "Content-Type:application/json" --insecure --silent https://NETSCALER_NSIP/nitro/v1/config/login -d '{"login":{"username":"NETSCALER_NITRO_USER", "password":"NETSCALER_NITRO_PASS"}}' | jq .sessionid) |
118 | | -echo $NETSCALER_NITRO_AUTH_TOKEN |
| 157 | +echo $echo $NETSCALER_NITRO_AUTH_TOKEN |
119 | 158 | ``` |
120 | 159 |
|
121 | | -## NetScaler Console (ADM) as a Proxy Server |
122 | | - |
123 | | -Refer to the [NetScaler ADM as an API proxy server](https://docs.netscaler.com/en-us/citrix-application-delivery-management-software/current-release/adm-as-api-proxy-server.html) for more details. |
| 160 | +### Invocation |
124 | 161 |
|
125 | | -The collection supports configuring NetScaler Console as a proxy server. This is useful when you have multiple NetScaler ADC appliances and you want to manage them using a single NetScaler Console. |
| 162 | +The credentials of the netscaler can be provided either in the playbook by hardcoding or defining in a inventory.ini file. |
126 | 163 |
|
127 | | -An example can be found in [examples/netscaler_console_as_proxy_server.yaml](examples/netscaler_console_as_proxy_server.yaml) |
| 164 | +#### Execution command when hosts are declared in playbook: |
128 | 165 |
|
129 | | -Also, refer to the [playbook_anatomy.md](playbook_anatomy.md#netscaler-console-as-an-api-proxy-server) for more details. |
130 | | - |
131 | | -### Steps to configure NetScaler Console as a proxy server |
132 | | - |
133 | | -1. Login to NetScaler Console and get the session ID |
134 | | -2. Use the session ID in the subsequent tasks to configure the managed NetScalers via the NetScaler Console as a proxy server |
135 | | -3. Logout from the NetScaler Console (optional) |
| 166 | +```bash |
| 167 | +ansible-playbook playbook.yaml [--verbose] |
| 168 | +``` |
136 | 169 |
|
137 | | -## Supported Ansible Versions |
| 170 | +#### Execution command hosts are declared in an inventory file: |
138 | 171 |
|
139 | | -This collection is tested for Ansible version 2.14 and above. |
| 172 | +```bash |
| 173 | +ansible-playbook playbook.yaml -i inventory.ini [--verbose] |
| 174 | +``` |
140 | 175 |
|
141 | | -> Please raise issues at <https://github.com/netscaler/ansible-collection-netscaleradc/issues> if you face any issues with the collection. |
| 176 | +## Testing |
142 | 177 |
|
143 | | -## Features of `netscaler.adc` collection |
| 178 | +The collection is tested using Github Actions. To know more about testing, please refer the [link]([https://github.com/netscaler/ansible-collection-netscaleradc/.github/workflow) to know more. |
144 | 179 |
|
145 | | -Refer to the [features_v2.md](features_v2.md) file for the features of the `netscaler.adc` collection. |
| 180 | +## Contributing |
146 | 181 |
|
147 | | -## Migrating from `citrix.adc` collection to `netscaler.adc` collection |
| 182 | +For external contributions, refer the [guidelines](https://github.com/netscaler/ansible-collection-netscaleradc/blob/c8c77cb4cb3905af8b90992bc55519f9a513ed08/CONTRIBUTING.md#L4). |
148 | 183 |
|
149 | | -> Both `citrix.adc` and `netscaler.adc` can be used in the same Ansible playbook. However, it is recommended to migrate to `netscaler.adc` collection. |
| 184 | +## Support |
150 | 185 |
|
151 | | -Refer to the [migrating_from_v1_v2.md](migrating_from_v1_v2.md) file for the migration steps. |
| 186 | +For issues : https://github.com/netscaler/ansible-collection-netscaleradc/issues |
152 | 187 |
|
153 | | -## Supported Modules in `netscaler.adc` collection |
| 188 | +For discussions or feature requests: https://github.com/netscaler/ansible-collection-netscaleradc/discussions |
154 | 189 |
|
155 | | -Refer to the [supported_modules_matrix.md](supported_modules_matrix.md) file for the list of supported modules in `netscaler.adc` collection. |
| 190 | +## Release Notes |
156 | 191 |
|
157 | | -## SSH connection module |
| 192 | +Please refer to the [link](https://github.com/netscaler/ansible-collection-netscaleradc/blob/0438f3253b2eca084760984b6564a0a7964a128d/CHANGELOG.md) for the release notes. |
158 | 193 |
|
159 | | -Refer https://github.com/netscaler/ansible-collection-netscaleradc/issues/309 |
160 | 194 |
|
161 | | -## Todo list for the `netscaler.adc` collection |
| 195 | +## License Information |
162 | 196 |
|
163 | | -- [x] Support for `nitro_auth_token` parameter in all modules. |
164 | | -- [x] Update supported matrix to have documentation links |
165 | | -- [x] Add appropriate license to the collection. |
166 | | -- [x] Upload the collection to Ansible Galaxy. |
167 | | -- [x] Support configuring ADC with ADM as proxy. Refer to [NetScaler ADM as an API proxy server](https://docs.netscaler.com/en-us/citrix-application-delivery-management-software/current-release/adm-as-api-proxy-server.html) for more details. |
168 | | -- [ ] Implement SSH connection module - Refer https://github.com/netscaler/ansible-collection-netscaleradc/issues/309 |
169 | | -- [ ] Support for generic modules similar to `citrix.adc.nitro_request` and `citrix.adc.nitro_resource`? |
170 | | -- [ ] migration tool to convert `citrix.adc` playbooks (including generic `citrix.adc.nitro_request` and `citrix.adc.nitro_resource` modules) to `netscaler.adc` modules |
171 | | -- [ ] Add more examples |
172 | | -- [ ] Write a python script which converts examples/playbook.yaml to module's EXAMPLE documentation |
173 | | -- [ ] Test modules against all NetScaler ADC versions. |
174 | | -- [x] Test modules againsts ansible versions 2.9+ |
175 | | -- [x] Configure GitHub Actions to automate the collection build and release process. |
176 | | -- [ ] Configure GitHub Actions to automate the collection testing process. |
177 | | -- [x] Configure GitHub Actions to automate the collection linting process. |
178 | | -- [x] Collect NetScaler info (version, etc) and store it in the `facts` dictionary |
| 197 | +The collection uses MIT license. You can refer the [link](https://github.com/netscaler/ansible-collection-netscaleradc/blob/0438f3253b2eca084760984b6564a0a7964a128d/LICENSE) to view license information. |
0 commit comments