How to update a user as a pseudo user in remote hosts using ansible.
Whenever we run a playbook from #Ansible to update something in a remote host it will ask for a pseudo password. Thus, to bypass exposing the pseudo password from the command line, we can make the user as a pseudo-user in the remote hosts.
To make a user as a pseudo-user in remote hosts which will be used to run the plays, please use #Ansible roles tasks and #Ansible play likes given below.
task.yml
---- name: Add sudoers | Allow 'ameyo' group to have passwordless sudo lineinfile: dest: /etc/sudoers state: present line: '<you_user_name> ALL=(ALL) NOPASSWD: ALL' validate: visudo -cf %s insertbefore: EOF
role.yml
---- include: adding-user-sudoers/main.yaml become: yes
ansible-playbook.yml
---- name: copying ssh key and updating sudoershosts: <your target group name>gather_facts: falsebecome: trueremote_user: <your_remote_user>roles: - add-sudoers-user