# Sshconnection vs terminal vs httpapi vs shell plugins

**URL:** <https://forum.ansible.com/t/sshconnection-vs-terminal-vs-httpapi-vs-shell-plugins/38194>\
**Category:** Ansible Developer\
**Tags:** netscaler\
**Created:** [July 6, 2023, 3:57am UTC](https://forum.ansible.com/t/sshconnection-vs-terminal-vs-httpapi-vs-shell-plugins/38194 "2023-07-06T03:57:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumanth\_Lingappa](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@Sumanth\_Lingappa](https://forum.ansible.com/u/Sumanth_Lingappa)\
**Post date:** [July 6, 2023, 3:57am UTC](https://forum.ansible.com/t/sshconnection-vs-terminal-vs-httpapi-vs-shell-plugins/38194/1 "2023-07-06T03:57:35Z")

</div>

Hello, community,  
I am currently working on writing a new set of NetScaler collections for ansible.  
We already have a collection maintained at [https://github.com/citrix/citrix-adc-ansible-modules](https://github.com/citrix/citrix-adc-ansible-modules)

I would like to extend this OR entirely change it to better.

NetScaler ADC under the hood is a FreeBSD OS and we have our own command prompt.

I need to take care of three things -

1. collection modules for resources to configure the NetScaler device over NITRO (HTTP)
2. module/plugin (I am not sure) to directly give FreeBSD commands (bypassing the initial NS-CLI prompt). This is for general OS operations like `create directory`, `copy`, `tar/untar`, run some shell scripts etc.
3. module/plugin to directly give nscli such as `show version`, `add lb vserver` commands in the playbook to configure the NetScaler device.  
For points 2 and 3, we have a `ssh-connection-plugin` - [ansible-collection-netscaleradc/ansible-collections/adc/plugins/connection/ssh\_citrix\_adc.py at citrix.adc · netscaler/ansible-collection-netscaleradc · GitHub](https://github.com/citrix/citrix-adc-ansible-modules/blob/master/ansible-collections/adc/plugins/connection/ssh_citrix_adc.py)

For point 1, we have modules

Now I see that there is a separate section in the Ansible documentation ([Network Developer Guide — Ansible Community Documentation](https://docs.ansible.com/ansible/latest/network/dev_guide/index.html))

Also, I see many plugins such as `httpapi`, `terminal`, `shell`, `network_cli` etc.

- Can you please help to understand the difference between these?
- What are the benefits I get if I choose `httpapi` plugin over our existing collection modules which uses ansible’s `fetch_url` function?

so that I can think of writing these plugins for our NetScaler ADC devices.

Thanks in advance,  
Sumanth Lingappa

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 6, 2023, 1:35pm UTC](https://forum.ansible.com/t/sshconnection-vs-terminal-vs-httpapi-vs-shell-plugins/38194/2 "2023-07-06T13:35:43Z")

</div>

shell plugins are basically for dealing with common commands in  
different shell environments, i.e create a temp dir, figure out the  
remote user home, etc

terminal plugins are really regex for matching prompts when not using  
a shell, they are for use with netcli/net\_conf plugins

httpapi/netcli/netconf plugins are "secondary connection pluigins"  
that are designed to run the module under 'local' connection and have  
the 2nd (true) connection to the device available to the module  
itself, for it to send commands over and receive feedback (where they  
might need to match against the terminal plugin).

---

<div class="post-metadata">

**Author:** ![Sumanth\_Lingappa1](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@Sumanth\_Lingappa1](https://forum.ansible.com/u/Sumanth_Lingappa1)\
**Post date:** [July 10, 2023, 3:52am UTC](https://forum.ansible.com/t/sshconnection-vs-terminal-vs-httpapi-vs-shell-plugins/38194/3 "2023-07-10T03:52:25Z")

</div>

Thank you for your response Brian.

Can you please help me to decide the following?  
**Do you see any advantage for us if we rewrite with new plugins than sticking to our ssh-connection?**

We have a ssh-connection plugin written almost 5 years ago.  
Examples you can find here: [https://github.com/citrix/citrix-adc-ansible-modules/tree/master/sample\_playbooks/citrix\_adc/citrix\_adc\_connection\_plugin](https://github.com/citrix/citrix-adc-ansible-modules/tree/master/sample_playbooks/citrix_adc/citrix_adc_connection_plugin)  
The code to the above ssh-connection is here: [https://github.com/citrix/citrix-adc-ansible-modules/blob/master/ansible-collections/adc/plugins/connection/ssh\_citrix\_adc.py](https://github.com/citrix/citrix-adc-ansible-modules/blob/master/ansible-collections/adc/plugins/connection/ssh_citrix_adc.py)

Here we are connecting to the SHELL prompt directly on our NetScaler device, and then trying to run commands using `nscli` script.

I think, if we can directly connect to our NetScaler prompt, we can directly send the “show version” (for eg) commands directly and get output. In my understanding, that’s where the `terminal` plugin comes from.

Since our existing ssh-connection was written a while ago (5 years), I am sure there must be a great good way in Ansible to connect to NetScaler (networking devices), which I am missing. Eg., `terminal` `netcli`, `net_conf` etc

Sumanth

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 10, 2023, 1:57pm UTC](https://forum.ansible.com/t/sshconnection-vs-terminal-vs-httpapi-vs-shell-plugins/38194/4 "2023-07-10T13:57:56Z")

</div>

That is not something I feel i can give advice on as I don't know the  
product well and have no idea about your resource availability and  
objectives.

Context is everything and as an outsider I barely have a sliver of it  
nor will you be able to give me enough in a few emails to give you  
relevant advice.

---

<div class="post-metadata">

**Author:** ![Sumanth\_Lingappa1](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@Sumanth\_Lingappa1](https://forum.ansible.com/u/Sumanth_Lingappa1)\
**Post date:** [July 11, 2023, 4:04am UTC](https://forum.ansible.com/t/sshconnection-vs-terminal-vs-httpapi-vs-shell-plugins/38194/5 "2023-07-11T04:04:35Z")

</div>

Thank you Brian. Your first email response will be helpful to decide in my situation.

Thanks again.
