# Ansible - Using the http get method to pull data  SSL Cert data

**URL:** <https://forum.ansible.com/t/ansible-using-the-http-get-method-to-pull-data-ssl-cert-data/33342>\
**Category:** Ansible Developer\
**Created:** [July 7, 2020, 10:57pm UTC](https://forum.ansible.com/t/ansible-using-the-http-get-method-to-pull-data-ssl-cert-data/33342 "2020-07-07T22:57:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FallGuy74](https://avatars.discourse-cdn.com/v4/letter/f/e9c0ed/32.png) [@FallGuy74](https://forum.ansible.com/u/FallGuy74)\
**Post date:** [July 7, 2020, 10:57pm UTC](https://forum.ansible.com/t/ansible-using-the-http-get-method-to-pull-data-ssl-cert-data/33342/1 "2020-07-07T22:57:26Z")

</div>

```auto
Hi everyone.

```

```auto
I've been working on an ansible playbook that retrieves SSL and Certificate data from a load balancer. I've been able to run the

```

```auto
playbook with success however, I'm not getting all the expected data. Below is a sample of my playbook:

```

```auto
gather_facts: false                         
  hosts: local  
  vars:                                                                                               
  env: dev                                                                                          

```

tasks:

```auto
   name: Get SSL Cert Info                                                                 
     avi_api_session                                                                           
     controller:                                                                                            
     tenant:                                                                                      
     timeout: 1000                                                                                   
     path: sslkeyandcertificate                                                               
     http_method: get                                                                            
     username:                                                                                   
   register: json                                                                                    
                                                                                                    
   debug: var=json

```

```auto

```

```auto
The data needed is about 10-12 pages. I'm only getting back a full page of data (if that). My goal is to pull back all the remaining pages. At this point, I'm not sure how to do that.

```

```auto
What have I tried? I've altered my script several different times and have created several variations of it. It either didn't work or it worked but did not produce the intended output.

```

```auto
Any help at this point would be greatly appreciated it. Thanks.

```

```auto

```

---

<div class="post-metadata">

**Author:** ![john.westcott.iv](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/john.westcott.iv/32/95_2.png) [@john.westcott.iv](https://forum.ansible.com/u/john.westcott.iv)\
**Post date:** [July 8, 2020, 5:14pm UTC](https://forum.ansible.com/t/ansible-using-the-http-get-method-to-pull-data-ssl-cert-data/33342/2 "2020-07-08T17:14:44Z")

</div>

I’m not sure if I am understanding the question correctly but if you are trying to get the SSL certificate that is being served through a port you could look at the get\_certificate module [https://docs.ansible.com/ansible/latest/modules/get\_certificate\_module.html#get-certificate-module](https://docs.ansible.com/ansible/latest/modules/get_certificate_module.html#get-certificate-module).

-John

---

<div class="post-metadata">

**Author:** ![FallGuy74](https://avatars.discourse-cdn.com/v4/letter/f/e9c0ed/32.png) [@FallGuy74](https://forum.ansible.com/u/FallGuy74)\
**Post date:** [July 8, 2020, 5:36pm UTC](https://forum.ansible.com/t/ansible-using-the-http-get-method-to-pull-data-ssl-cert-data/33342/3 "2020-07-08T17:36:40Z")

</div>

Hi John. Thanks for the reply. Let me explain and clarify a little more.

I have a load balancer that has several virtual services or urls that have been created on the load balancer. That load balancer is also responsible for managing or housing all of the certs for those virtual services. Right now, there are currently over a 100 plus certs. I needed a way to query the load balancer to get a list of those certs. I’m able to run my current playbook but it’s only pulling a select few in a json format. I’m not if I need to add another module to my playbook to get the entire list or if I need to do some type of loop to get the remaining list.

Each certificate contains the certificate name, the status, common name, issuer name, algorithm, self signed, and the expiration date. When I view the information from the load balancer itself, it’s about 12 pages. When I run my playbook, I’m not even close to that number of pages being retrieved.

Hope this helps.

Thanks.

---

<div class="post-metadata">

**Author:** ![john.westcott.iv](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/john.westcott.iv/32/95_2.png) [@john.westcott.iv](https://forum.ansible.com/u/john.westcott.iv)\
**Post date:** [July 8, 2020, 6:04pm UTC](https://forum.ansible.com/t/ansible-using-the-http-get-method-to-pull-data-ssl-cert-data/33342/4 "2020-07-08T18:04:36Z")

</div>

Ok, I was not understanding the question correctly. Unfortunately I am not familiar with that type of load balancer.

But here are some general questions I might ask if I was troubleshooting this.  
Are you are using the same user from Ansible as you do to login into the device so that there isn’t any permissions causing the discrepancy?Based on [https://avinetworks.com/docs/18.1/api-guide/SSLKeyAndCertificate/index.html](https://avinetworks.com/docs/18.1/api-guide/SSLKeyAndCertificate/index.html) it looks like that GET method returns a count parameter.  
Are you able to accesss that count parameter from the ansible module?  
Can you run the GET from command line via CURL (or wget or anything else) and see what the count looks like there?  
Can you hit the API from your browser and see what the count is?

-John
