Unable to change user for play

Hi,

Oam.yml

  • name: apply common configuration to all nodes

hosts: all

user: root

become: yes

become_user: sudo

become_method: sudo

vars_files:

  • dependency_list.yml

  • client_dependency_list.yml

roles:

  • { role: server, when: server_or_client_installation|int == 1, tags: server, when: ansible_os_family == “RedHat” and ansible_distribution_major_version|int >= 6}

  • { role: client, when: server_or_client_installation|int == 2, tags: client, when: ansible_os_family == “RedHat” and ansible_distribution_major_version|int >= 6}

Hosts

172.19.4.64 ansible_ssh_user=“root”

Query:

Want to sudo on the server where i am running this playbook and it sudo does not require a password.

the above play throws authentication failure error

Please help.

Thanks in advance,

Mona G

ansible_ssh_user=root means, logg in to 172.19.4.64 as the user root.
If you log in as root you don't need sudo, so I suspect you have the wrong user here since you would like to use sudo and get authentication failure.