Ansible playbook for accessing url

2,809 views
Skip to first unread message

Seeram Venkatesh

unread,
Aug 29, 2017, 9:25:11 AM8/29/17
to Ansible Project
Hello Techies,

I am improvising my Ansible skills in a very slow pace and I got stuck here: 
Is there anyway to hit my ticket management system (cherwell) url and login to it with credentials through Ansible? I've so far researched about uri module but not able to fetch more?
TIA. 


raj kr

unread,
Aug 29, 2017, 9:35:20 AM8/29/17
to Ansible Project
This possible via uri,
if rest api is supported on your managemennt system , you can define login structure and form url under uri and provide login structure to login

Seeram Venkatesh

unread,
Aug 29, 2017, 9:41:13 AM8/29/17
to ansible...@googlegroups.com
Hi Raj, 
Thanks for the response. 
Ya I figured out something about uri module and wrote a started writing a play. 
---
- name: hitting admin console
  hosts: appservers
  become: true
  become_user: weblogic
  tasks:
   - name: post to consul
     uri:

I got the following error. 
TASK [post to consul] ***************************************************************************************************************************************
fatal: [10.11.60.92]: FAILED! => {"failed": true, "msg": "Failed lookup url for http://graycsm1wv/CherwellAPI/ : <urlopen error [Errno 111] Connection refused>"}

Please suggest here. 
Also is there any example how to pass credentials for that url to login?

TIA.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/hdpP689dM6Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f2e09727-2e09-44ae-9a6f-41e8c3794319%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Dick Visser

unread,
Aug 29, 2017, 1:53:50 PM8/29/17
to ansible...@googlegroups.com
Hi there

Couple of issues.
* Your indentation seems off - all the parameters for 'uri' need to be
indented further. See
http://docs.ansible.com/ansible/latest/uri_module.html#examples
* By the looks of it you seem to want to do a POST request, but you
didn't specify the method as such (and the default is GET). See
previous URL.
* The error you're getting seems to indicate a name resolution issue.
Remember that this code is not run on your management station, but on
your target. So if that is not able to resolve "graycsm1wv" then it
won't work. Given that it's a single label hostname you'll likely need
some specific resolver local to your site.


Dick

On 29 August 2017 at 15:41, Seeram Venkatesh
>> ansible-proje...@googlegroups.com.
>> To post to this group, send email to ansible...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAKQb6PFFp0duUr4Zv48jLVv9s8mUG7fY4s1hvw-znpLtAnhCBw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Dick Visser
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs
Reply all
Reply to author
Forward
0 new messages