'ESTABLISH SSH CONNECTION FOR USER: root

I have to run my playbook as an ansible user. I have the following ansible.cfg file

[defaults]
inventory = ./inventory
deprecation_warnings=False
host_key_checking = False
remote_user = ansible
private_key_file = /root/.ssh/ansbile 

[privilege_escalation]
become = true
become_method = sudo
become_user = ansible
become_ask_pass = False

and the adhoc command is ansible-playbook /root/playbooks/aio.yaml ansible_ssh_user=ansible

But while I run this it is run as a root user

error log

I can't make changes to the inventory, I can only edit the ansible.cfg file



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source