Add netscaler_server module (#25537)

This commit is contained in:
George Nikolopoulos
2017-06-27 20:38:00 +03:00
committed by Ganesh Nalawade
parent 96dcd1060c
commit 6bed831f8c
19 changed files with 1455 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
---
- hosts: netscaler
gather_facts: no
@@ -9,3 +11,4 @@
roles:
- { role: netscaler_service, when: "limit_to in ['*', 'netscaler_service']" }
- { role: netscaler_server, when: "limit_to in ['*', 'netscaler_server']" }

View File

@@ -0,0 +1,6 @@
---
testcase: "*"
test_cases: []
nitro_user: nsroot
nitro_pass: nsroot

View File

@@ -0,0 +1,5 @@
[netscaler]
netscaler01 nsip=172.18.0.2 nitro_user=nsroot nitro_pass=nsroot

View File

@@ -0,0 +1,2 @@
---
- { include: nitro.yaml, tags: ['nitro'] }

View 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

View File

@@ -0,0 +1,82 @@
---
- include: "{{ role_path }}/tests/nitro/server/setup.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server/setup.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server/setup.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server/setup.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server/update.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server/update.yaml"
vars:
check_mode: no
- include: "{{ role_path }}/tests/nitro/server/update.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server/update.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server/remove.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server/remove.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server/remove.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server/remove.yaml"
vars:
check_mode: no
- assert:
that: not result|changed

View File

@@ -0,0 +1,15 @@
---
- name: Remove basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
name: test-server-1
ipaddress: 10.10.10.10

View File

@@ -0,0 +1,16 @@
---
- name: Setup basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
name: test-server-1
ipaddress: 10.10.10.10
comment: comment for server

View File

@@ -0,0 +1,16 @@
---
- name: Setup basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
name: test-server-1
ipaddress: 11.11.11.11
disabled: yes

View File

@@ -0,0 +1,82 @@
---
- include: "{{ role_path }}/tests/nitro/server_domain/setup.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/setup.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/setup.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/setup.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/update.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/update.yaml"
vars:
check_mode: no
- include: "{{ role_path }}/tests/nitro/server_domain/update.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/update.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/remove.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/remove.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/remove.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_domain/remove.yaml"
vars:
check_mode: no
- assert:
that: not result|changed

View File

@@ -0,0 +1,14 @@
---
- name: Remove basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
name: test-server-domain

View File

@@ -0,0 +1,16 @@
---
- name: Setup basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
name: test-server-domain
domain: example.com
ipv6address: no

View File

@@ -0,0 +1,18 @@
---
- name: Setup basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
name: test-server-domain
domain: example.com
translationip: 192.168.1.1
translationmask: 255.255.255.0
domainresolveretry: 10

View File

@@ -0,0 +1,82 @@
---
- include: "{{ role_path }}/tests/nitro/server_ipv6/setup.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/setup.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/setup.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/setup.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/update.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/update.yaml"
vars:
check_mode: no
- include: "{{ role_path }}/tests/nitro/server_ipv6/update.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/update.yaml"
vars:
check_mode: no
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/remove.yaml"
vars:
check_mode: yes
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/remove.yaml"
vars:
check_mode: no
- assert:
that: result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/remove.yaml"
vars:
check_mode: yes
- assert:
that: not result|changed
- include: "{{ role_path }}/tests/nitro/server_ipv6/remove.yaml"
vars:
check_mode: no
- assert:
that: not result|changed

View File

@@ -0,0 +1,14 @@
---
- name: Remove basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: absent
name: test-server-ipv6

View File

@@ -0,0 +1,15 @@
---
- name: Setup basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
name: test-server-ipv6
ipaddress: ff::fa:0

View File

@@ -0,0 +1,15 @@
---
- name: Setup basic server
delegate_to: localhost
register: result
check_mode: "{{ check_mode }}"
netscaler_server:
nitro_user: "{{nitro_user}}"
nitro_pass: "{{nitro_pass}}"
nsip: "{{nsip}}"
state: present
name: test-server-ipv6
ipaddress: ff::fb:0