Closed miguelcastilho closed 1 year ago
Hi @miguelcastilho,
We are using the same session for all the tasks in a given playbook. And hence there wont be excess of login sessions.
- name: Fetch Session Id
oneview_get_session_id:
config: "{{ config }}"
name: "Test_Session"
delegate_to: localhost
register: session
- debug: var=session
- name: Create or Update an Appliance Device SNMPv1 Trap Destination by Destination Address
oneview_appliance_device_snmp_v1_trap_destinations:
config: "{{ config }}"
sessionID: "{{ session.ansible_facts.session }}"
state: present
name: "{{ contents.appliance_device_snmp_v1_trap_destinations.destination_address }}"
data:
communityString: "public"
destination: "{{ contents.appliance_device_snmp_v1_trap_destinations.destination_address }}"
port: 162
delegate_to: localhost
Hi @alisha-k-kalladassery ,
While it is true that using the same session for all tasks in a given playbook can prevent the creation of multiple login sessions, it is also important to note that by default, a new login session is established by each task if a session ID is not passed as an argument. Thus my suggestion of incorporating a mechanism for cleaning up the login session after each task seems reasonable. This can help ensure that the session is terminated once it is no longer needed.
Therefore, I would recommend considering adding a cleanup method to the code to terminate the session after each task is completed if the session ID is not explicitly passed as an argument. This can help avoid any potential issues with excess login sessions.
Hi @miguelcastilho Thanks for posting your query here. We have added this to our backlog. We will be implementing this per priority.
Thanks
Greetings,
I have encountered an issue with OneView, where an excess of login sessions remain open. Upon examining the code, I noticed that there is no implementation of a method to terminate the current session after the completion of a task. Wouldn't it be reasonable to incorporate a mechanism for clearing the session after each task? I am unsure if this was an oversight or if there is a specific rationale for this omission.