Skip to content

Commit

Permalink
sslcertkey integration added
Browse files Browse the repository at this point in the history
Signed-off-by: Sumanth Lingappa <[email protected]>
  • Loading branch information
sumanth-lingappa committed Jan 30, 2024
1 parent bb81e72 commit a4ae75f
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/integration/targets/sslcertkey/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gather_facts/no
netscaler/cpx/
netscaler/vpx/
141 changes: 141 additions & 0 deletions tests/integration/targets/sslcertkey/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
- name: Include prerequisite tasks
ansible.builtin.include_tasks: setup.yaml
- name: SSLCERTKEY | ADD | --check
delegate_to: localhost
register: result
check_mode: true
tags: test
netscaler.adc.sslcertkey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: present
certkey: "{{ intermediate_cert }}"
cert: "{{ intermediate_cert }}.crt"
key: "{{ intermediate_cert }}.key"
linkcertkeyname: "{{ root_cert }}"
- name: Assert | SSLCERTKEY | ADD | --check
tags: test
ansible.builtin.assert:
that:
- "result.failed==false"
- "result.changed==true"
- name: SSLCERTKEY | ADD
delegate_to: localhost
register: result
check_mode: false
tags: test
netscaler.adc.sslcertkey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: present
certkey: "{{ intermediate_cert }}"
cert: "{{ intermediate_cert }}.crt"
key: "{{ intermediate_cert }}.key"
linkcertkeyname: "{{ root_cert }}"
- name: Assert | SSLCERTKEY | ADD
ansible.builtin.assert:
that:
- "result.failed==false"
- "result.changed==true"
- name: SSLCERTKEY | ADD | idempotent
delegate_to: localhost
register: result
check_mode: false
tags: test
netscaler.adc.sslcertkey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: present
certkey: "{{ intermediate_cert }}"
cert: "{{ intermediate_cert }}.crt"
key: "{{ intermediate_cert }}.key"
linkcertkeyname: "{{ root_cert }}"
- name: Assert | SSLCERTKEY | ADD | idempotent
tags: test
ansible.builtin.assert:
that:
- "result.failed==false"
- "result.changed==false"
- name: SSLCERTKEY | DELETE | --check
delegate_to: localhost
register: result
check_mode: true
tags: test
netscaler.adc.sslcertkey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: absent
certkey: "{{ intermediate_cert }}"
cert: "{{ intermediate_cert }}.crt"
key: "{{ intermediate_cert }}.key"
linkcertkeyname: "{{ root_cert }}"
- name: Assert | SSLCERTKEY | DELETE | --check
tags: test
ansible.builtin.assert:
that:
- "result.failed==false"
- "result.changed==true"
- name: SSLCERTKEY | DELETE
delegate_to: localhost
register: result
check_mode: false
tags: test
netscaler.adc.sslcertkey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: absent
certkey: "{{ intermediate_cert }}"
cert: "{{ intermediate_cert }}.crt"
key: "{{ intermediate_cert }}.key"
linkcertkeyname: "{{ root_cert }}"
- name: Assert | SSLCERTKEY | DELETE
ansible.builtin.assert:
that:
- "result.failed==false"
- "result.changed==true"
- name: SSLCERTKEY | DELETE | idempotent
delegate_to: localhost
register: result
check_mode: false
tags: test
netscaler.adc.sslcertkey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: absent
certkey: "{{ intermediate_cert }}"
cert: "{{ intermediate_cert }}.crt"
key: "{{ intermediate_cert }}.key"
linkcertkeyname: "{{ root_cert }}"
- name: Assert | SSLCERTKEY | DELETE | idempotent
tags: test
ansible.builtin.assert:
that:
- "result.failed==false"
- "result.changed==false"
- name: Include prerequisite tasks
ansible.builtin.include_tasks: teardown.yaml
67 changes: 67 additions & 0 deletions tests/integration/targets/sslcertkey/tasks/setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
- name: Create ssl rsakey intermediate_cert
delegate_to: localhost
netscaler.adc.sslrsakey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: created
keyfile: "{{ intermediate_cert }}.key"
bits: 2048
exponent: F4
keyform: PEM
- name: Create ssl certReq intermediate_cert.csr
delegate_to: localhost
netscaler.adc.sslcertreq:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: created
reqfile: "{{ intermediate_cert }}.csr"
keyfile: "{{ intermediate_cert }}.key"
keyform: PEM
countryname: IN
statename: KAR
organizationname: example
commonname: example
emailaddress: [email protected]
- name: Create ssl cert intermediate_cert.crt
delegate_to: localhost
netscaler.adc.sslcert:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: created
certfile: "{{ intermediate_cert }}.crt"
reqfile: "{{ intermediate_cert }}.csr"
keyform: PEM
days: 1480
certform: PEM
cacert: "{{ root_cert }}.cert"
cacertform: PEM
cakey: "{{ root_cert }}.key"
cakeyform: PEM
caserial: "{{ root_cert }}.srl"
certtype: SRVR_CERT
- name: Create Root SSL CertKey
delegate_to: localhost
netscaler.adc.sslcertkey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: present
certkey: "{{ root_cert }}"
cert: "{{ root_cert }}.cert"
key: "{{ root_cert }}.key"
14 changes: 14 additions & 0 deletions tests/integration/targets/sslcertkey/tasks/teardown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Delete Root SSL CertKey
delegate_to: localhost
netscaler.adc.sslcertkey:
nsip: "{{ nsip }}"
nitro_user: "{{ nitro_user }}"
nitro_pass: "{{ nitro_pass }}"
nitro_protocol: "{{ nitro_protocol }}"
validate_certs: "{{ validate_certs }}"
save_config: "{{ save_config }}"
state: absent
certkey: "{{ root_cert }}"
cert: "{{ root_cert }}.cert"
key: "{{ root_cert }}.key"
3 changes: 3 additions & 0 deletions tests/integration/targets/sslcertkey/vars/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
intermediate_cert: test1-sni
root_cert: ns-root

0 comments on commit a4ae75f

Please sign in to comment.