fatal: [localhost]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p "echo /var/tmp"&& mkdir "echo /var/tmp/ansible-tmp-1657172514.8192306-2106-9375282374437" && echo ansible-tmp-1657172514.8192306-2106-9375282374437="echo /var/tmp/ansible-tmp-1657172514.8192306-2106-9375282374437" ), exited with result 142, stdout output: Please login as the user "cloud-user" rather than the user "root".\n\n”, “unreachable”: true}
I am able to log in with cloud-user and then with sudo privileges as root, I have implemented a play book. So that I can execute playbook with root privileges.
the same issue happens even I have provided with -K argument:
SSH password:
PLAY [default] ********************************************************************************************************************************************************************************************
fatal: [localhost]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p "echo /var/tmp"&& mkdir "echo /var/tmp/ansible-tmp-1657181023.834322-2338-216353050127500" && echo ansible-tmp-1657181023.834322-2338-216353050127500="echo /var/tmp/ansible-tmp-1657181023.834322-2338-216353050127500" ), exited with result 142, stdout output: Please login as the user "cloud-user" rather than the user "root".\n\n”, “unreachable”: true}
PLAY RECAP ************************************************************************************************************************************************************************************************
PLAY [default] ********************************************************************************************************************************************************************************************
fatal: [ansible_user=cloud-user]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: ssh: Could not resolve hostname ansible_user=cloud-user: Name or service not known”, “unreachable”: true}
fatal: [localhost]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p "echo Please login as the user \"cloud-user\" rather than the user \"root\"./.ansible/tmp"&& mkdir "echo Please login as the user \"cloud-user\" rather than the user \"root\"./.ansible/tmp/ansible-tmp-1657190959.6394126-3019-148910985051576" && echo ansible-tmp-1657190959.6394126-3019-148910985051576="echo Please login as the user \"cloud-user\" rather than the user \"root\"./.ansible/tmp/ansible-tmp-1657190959.6394126-3019-148910985051576" ), exited with result 142, stdout output: Please login as the user "cloud-user" rather than the user "root".\n\n”, “unreachable”: true}
PLAY RECAP ************************************************************************************************************************************************************************************************