I had a working playbook in my test environment, where my user was root user itslef and didnt have any issue.
When i moved my playbook to staging environment , there my login user account is “admin” which is sudo user. But all of my playbooks are failing in this environment.
Yes, Password required for any action . because my user “admin” is created and added to sudoers group in staging environment where the playbook is failing.
Whereas in my development environment the playbook was working as there i jhad root user password.
PLAY [Replace the silent-install-server_ file to each Application Servers] **********************************************************************************
TASK [Gathering Facts] **************************************************************************************************************************************
fatal: [10.16.24.103]: FAILED! => {“changed”: false, “module_stderr”: “Shared connection to 10.16.24.103 closed.\r\n”, “module_stdout”: “sudo: a password is required\r\n”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}
fatal: [10.16.24.102]: FAILED! => {“changed”: false, “module_stderr”: “Shared connection to 10.16.24.102 closed.\r\n”, “module_stdout”: “sudo: a password is required\r\n”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}
ok: [localhost]
TASK [check the folder existance] ***************************************************************************************************************************
ok: [localhost]
TASK [CCM Server] *******************************************************************************************************************************************
fatal: [localhost]: FAILED! => {“msg”: “Failed to get information on remote file (/opt/CLM-Web-Installer-Linux-6.0.5/im/linux.gtk.x86_64/silent-install-server_CCM.xml): Shared connection to 10.16.24.102 closed.\r\n”}
to retry, use: --limit @/etc/ansible/roles/IBM2/tasks/best/silentiInstallerfile1.retry
For such situations, I would enable the 'admin' user to escalate privileges with sudo without specifying password. You can configure sudoer's to escalate privilege without password.
I already tried with different options of become as given in the link
But couldn’t resolve . I am not sure that which part of the playbook which I need to modify inorder to make it run for admin user.
Where this playbook is working fine in another environmental where using root user
I would first make sure that sudoer configuration is correct on the target server. So, logon to server manually and make sure you can use sudo without password.
ansible-playbook -k silentiInstallerfile1.yml
SSH password:
ERROR! ‘ansible_become_user’ is not a valid attribute for a Play
The error appears to have been in ‘/etc/ansible/roles/IBM2/tasks/best/silentiInstallerfile1.yml’: line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
name: Replace the silent-install-server_ file to each Application Servers
^ here
Are you both representing the same organization and hence the same problem?
I am confused by multiple situations:
"Yes. I had added the user admin to sudoers and made password less as same as given for root user in the sudoers file." - vivuu1989@gmail.com
"Yes, Password required for any action . because my user "admin" is created and added to sudoers group in staging environment where the playbook is failing." - visar <vivuu1989@gmail.com>