saving login details in remote device

how can i write the ansible playbook for finding the last login details and saving those details in my remote device and updating in every details when user login with same ip address