mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 12:03:58 -07:00
New module: manage Citrix Netscaler service configuration (network/netscaler/netscaler_service) (#25129)
* netscaler_service initial implementation * Changes as requested by reviewers * Skip some tests if under python2.6 and importing requests library * Change option "operation" to "state" * Remove print statements from netscaler module utils * Catch all exceptions during login * Fix fail message * Add common option save_config
This commit is contained in:
parent
2220362a5f
commit
a00089c341
24 changed files with 2328 additions and 0 deletions
11
test/integration/netscaler.yaml
Normal file
11
test/integration/netscaler.yaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- hosts: netscaler
|
||||
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: netscaler_service, when: "limit_to in ['*', 'netscaler_service']" }
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
testcase: "*"
|
||||
test_cases: []
|
||||
|
||||
nitro_user: nsroot
|
||||
nitro_pass: nsroot
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
|
||||
[netscaler]
|
||||
|
||||
172.18.0.2 nsip=172.18.0.2 nitro_user=nsroot nitro_pass=nsroot
|
2
test/integration/roles/netscaler_service/tasks/main.yaml
Normal file
2
test/integration/roles/netscaler_service/tasks/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: nitro.yaml, tags: ['nitro'] }
|
14
test/integration/roles/netscaler_service/tasks/nitro.yaml
Normal file
14
test/integration/roles/netscaler_service/tasks/nitro.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- name: collect all nitro test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/nitro"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,57 @@
|
|||
---
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/adns_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/adns_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/adns_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/adns_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/adns_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/adns_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/adns_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/adns_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
|
||||
- name: Remove adns service
|
||||
delegate_to: localhost
|
||||
register: result
|
||||
check_mode: "{{ check_mode }}"
|
||||
netscaler_service:
|
||||
|
||||
nitro_user: "{{nitro_user}}"
|
||||
nitro_pass: "{{nitro_pass}}"
|
||||
nsip: "{{nsip}}"
|
||||
|
||||
state: absent
|
||||
name: service-adns
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
|
||||
- name: Setup adns service
|
||||
delegate_to: localhost
|
||||
register: result
|
||||
check_mode: "{{ check_mode }}"
|
||||
netscaler_service:
|
||||
|
||||
nitro_user: "{{nitro_user}}"
|
||||
nitro_pass: "{{nitro_pass}}"
|
||||
nsip: "{{nsip}}"
|
||||
state: present
|
||||
|
||||
name: service-adns
|
||||
ipaddress: 192.168.1.3
|
||||
port: 80
|
||||
servicetype: ADNS
|
|
@ -0,0 +1,85 @@
|
|||
---
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/update.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/update.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/update.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/update.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/http_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
|
||||
- name: Remove htttp service
|
||||
netscaler_service:
|
||||
|
||||
nitro_user: "{{nitro_user}}"
|
||||
nitro_pass: "{{nitro_pass}}"
|
||||
nsip: "{{nsip}}"
|
||||
|
||||
state: absent
|
||||
|
||||
name: service-http
|
||||
|
||||
delegate_to: localhost
|
||||
register: result
|
||||
check_mode: "{{ check_mode }}"
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
|
||||
- name: Setup http service
|
||||
netscaler_service:
|
||||
|
||||
nitro_user: "{{nitro_user}}"
|
||||
nitro_pass: "{{nitro_pass}}"
|
||||
nsip: "{{nsip}}"
|
||||
|
||||
state: present
|
||||
|
||||
name: service-http
|
||||
ip: 192.168.1.1
|
||||
ipaddress: 192.168.1.1
|
||||
port: 80
|
||||
servicetype: HTTP
|
||||
cachetype: TRANSPARENT
|
||||
maxclient: 100
|
||||
healthmonitor: no
|
||||
maxreq: 200
|
||||
cacheable: no
|
||||
cip: ENABLED
|
||||
cipheader: client-ip
|
||||
usip: yes
|
||||
useproxyport: yes
|
||||
sc: off
|
||||
sp: off
|
||||
rtspsessionidremap: off
|
||||
clttimeout: 100
|
||||
svrtimeout: 100
|
||||
customserverid: 476
|
||||
cka: yes
|
||||
tcpb: yes
|
||||
cmp: no
|
||||
maxbandwidth: 10000
|
||||
accessdown: "NO"
|
||||
monthreshold: 100
|
||||
downstateflush: ENABLED
|
||||
hashid: 10
|
||||
comment: some comment
|
||||
appflowlog: ENABLED
|
||||
processlocal: ENABLED
|
||||
graceful: no
|
||||
|
||||
monitor_bindings:
|
||||
- monitorname: ping
|
||||
weight: 50
|
||||
- monitorname: http
|
||||
weight: 50
|
||||
|
||||
delegate_to: localhost
|
||||
register: result
|
||||
check_mode: "{{ check_mode }}"
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
|
||||
- name: Update http service
|
||||
netscaler_service:
|
||||
|
||||
nitro_user: "{{nitro_user}}"
|
||||
nitro_pass: "{{nitro_pass}}"
|
||||
nsip: "{{nsip}}"
|
||||
|
||||
state: present
|
||||
|
||||
name: service-http
|
||||
ip: 192.168.1.1
|
||||
ipaddress: 192.168.1.1
|
||||
port: 80
|
||||
servicetype: HTTP
|
||||
cachetype: TRANSPARENT
|
||||
maxclient: 100
|
||||
healthmonitor: no
|
||||
maxreq: 200
|
||||
cacheable: no
|
||||
cip: ENABLED
|
||||
cipheader: client-ip
|
||||
usip: yes
|
||||
useproxyport: yes
|
||||
sc: off
|
||||
sp: off
|
||||
rtspsessionidremap: off
|
||||
clttimeout: 100
|
||||
svrtimeout: 100
|
||||
customserverid: 476
|
||||
cka: yes
|
||||
tcpb: yes
|
||||
cmp: no
|
||||
maxbandwidth: 20000
|
||||
accessdown: "NO"
|
||||
monthreshold: 100
|
||||
downstateflush: ENABLED
|
||||
hashid: 10
|
||||
comment: some comment
|
||||
appflowlog: ENABLED
|
||||
processlocal: ENABLED
|
||||
netprofile: net-profile-1
|
||||
|
||||
monitor_bindings:
|
||||
- monitorname: http
|
||||
weight: 100
|
||||
|
||||
delegate_to: localhost
|
||||
register: result
|
||||
check_mode: "{{ check_mode }}"
|
|
@ -0,0 +1,57 @@
|
|||
---
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/ssl_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/ssl_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/ssl_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/ssl_service/setup.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/ssl_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/ssl_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/ssl_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: yes
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
||||
|
||||
- include: "{{ role_path }}/tests/nitro/ssl_service/remove.yaml"
|
||||
vars:
|
||||
check_mode: no
|
||||
|
||||
- assert:
|
||||
that: not result|changed
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
|
||||
- name: Remove ssl service
|
||||
delegate_to: localhost
|
||||
register: result
|
||||
check_mode: "{{ check_mode }}"
|
||||
netscaler_service:
|
||||
|
||||
nitro_user: "{{nitro_user}}"
|
||||
nitro_pass: "{{nitro_pass}}"
|
||||
nsip: "{{nsip}}"
|
||||
|
||||
state: absent
|
||||
name: service-ssl
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
|
||||
- name: Setup ssl service
|
||||
delegate_to: localhost
|
||||
register: result
|
||||
check_mode: "{{ check_mode }}"
|
||||
netscaler_service:
|
||||
|
||||
nitro_user: "{{nitro_user}}"
|
||||
nitro_pass: "{{nitro_pass}}"
|
||||
nsip: "{{nsip}}"
|
||||
|
||||
state: present
|
||||
name: service-ssl
|
||||
ipaddress: 192.168.1.2
|
||||
port: 80
|
||||
servicetype: SSL
|
||||
cleartextport: 88
|
Loading…
Add table
Add a link
Reference in a new issue