Jump to content
Welcome to our new Citrix community!

Copying .cer .key files to Netscaler via Ansible or Python?


Dane DeValcourt

Recommended Posts

Anyone have any experience with either a python script or preferably an ansible playbook that could be used to upload an ssl .cer and .key over to a netscaler device as well as add cert command  and bind cert ?

 

I am pretty sure I've seen examples of doing the config pieces using Ansible.  However I'm not sure what is involved with copying the files needed over to the device.

 

I've noticed that with other vendors, namely Cisco and Juniper, they have specific "modules" within Ansible for handling say scp for file transfers.  I don't think I've seen that with Netscaler.

 

That leads me to another question, why doesn't it seem to be too much discussion and content related to Ansible and Netscaler ?  The forums don't seem to have much.  Blogs don't seem to have much either.

 

Really just not finding much in the way of people discussing using Ansible to automate much with Netscaler.  Being new to Netscaler operations, I'm starting to wonder what are others doing to orchestrate and automate with regards to Netscaler?

Link to comment
Share on other sites

Netscaler allows copying of files, cert files using NITRO API

 

https://docs.citrix.com/en-us/netscaler/11-1/nitro-api/nitro-rest/nitro-rest-general/nitro-rest-file-operations.html

 

The same can be used in Python or Ansible playbook

 

Below link contains the latest ansible modules for Citrix ADC(aka NetScaler)

https://github.com/citrix/netscaler-ansible-modules

 

Link to comment
Share on other sites

  • 1 year later...

I was able to accomplish this with Ansible using the following playbook and tasks.

 

---                                                                                                            

- hosts: localhost
  gather_facts: no
  
  tasks:
  
    - name: Import SSL Key
      delegate_to: localhost
      netscaler_nitro_request:
        nsip: 1.1.1.1
        nitro_user: 
        nitro_pass: 
        operation: action
        action: import
        resource: sslkeyfile
        attributes:
          name: templbcert.2019c.key
          src: http://2.2.2.2:8080/templbcert.2019c.key
    
    - name: Import SSL Cert
      delegate_to: localhost
      netscaler_nitro_request:
        nsip: 1.1.1.1
        nitro_user: 
        nitro_pass: 
        operation: action
        action: import
        resource: sslcertfile
        attributes:
          name: templbcert.2019c.cer
          src: http://2.2.2.2:8080/templbcert.2019c.cer

    - name: Setup SSL Certificate Key
      delegate_to: localhost
      netscaler_ssl_certkey:
        nsip: 1.1.1.1
        nitro_user: 
        nitro_pass: 
        certkey: templbcert.2019c.certkey
        cert: templbcert.2019c.cer
        key: templbcert.2019c.key

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...