I need to run cmd on sles12 sp5 server using cmd - "sudo rootsh" on remote node using ansible playbook. This prompts for root pwd. How to pass the password during ansible playbook execution time? i tried the following playbook but it errors timeout issue.
--
- hosts: '{{ host }}'
gather_facts: yes
tasks:
- name: Get current user on remote
become: yes
become_exe: "sudo rootsh"
become_method: sudo
become_user: root
become_flags: -i
command: whoami
register: out
- debug:
msg: "{{out}}"
Error msg:
-------------
TASK [Get current user on remote] *******************************************************************************************
fatal: [host.iil.corp.com]: FAILED! => {"msg": "Timeout (32s) waiting for privilege escalation prompt: Subject to corp's Global Employee and Global Contingent Worker Privacy Notices\r\n(see https://employeecontent.corp.com/content/corp/Global_Employee_and_Global_Contingent_Worker_Privacy.html )\r\nall system access and delegated/privileged activity on the corp network\r\nmay be logged for auditing and security purposes, including your username \r\nand commands used. Log records may be retained for up to 1 year.\r\n\r\nWe trust you have received the usual lecture from the local System\r\nAdministrator. It usually boils down to these three things:\r\n\r\n #1) Respect the privacy of others.\r\n #2) Think before you type.\r\n #3) With great power comes great responsibility.\r\n\r\nRemember you may use 'sudo -l' to review a list of authorized commands.\r\n\r\n"}