Alexandru Obretin <[email protected]> writes: > Hello, > > I am working on a project that wants to provide ansible support for a > solution that exposes a REST API. Over this API I designed an intermediate > python layer to translate the yaml playbook into REST calls. > > In my case, the playbook is composed of one task executed multiple times. > During execution, I open a http connection to the actual target equipment > using the python library requests, get an authentication token and send > http calls. I noticed in the log files that although my fetch > authentication token mechanism is a singleton class and all the tasks are > executed against the same IP address, for each task the session is > recreated and a new token is fetched. > > Is there a way to reuse the http connection within the task list? > > I have seen a similar post called: *connection caching throughout a play *but > I hope there might be a workaround.
Hi Alexandru, You can use a HttpApi plugin for that. See: https://docs.ansible.com/ansible/latest/plugins/httpapi.html Best regards, -- Gonéri Le Bouder -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/87r26vioxn.fsf%40t580-gone.lebouder.net. For more options, visit https://groups.google.com/d/optout.
