cat hosts
[default]
localhost
ansible_user=cloud-user
odsec-test ~]# vi hosts
[root@modsec-test ~]# ansible-playbook -i ./hosts modsec-compile.yml
--private-key nonprod
PLAY [default]
********************************************************************************************************************************************************************************************
TASK [Gathering Facts]
************************************************************************************************************************************************************************************
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
************************************************************************************************************************************************************************************************
ansible_user=cloud-user : ok=0 changed=0 unreachable=1 failed=0
skipped=0 rescued=0 ignored=0
localhost : ok=0 changed=0 unreachable=1 failed=0
skipped=0 rescued=0 ignored=0
On Thu, Jul 7, 2022 at 3:47 PM Stefan Hornburg (Racke) <[email protected]>
wrote:
> On 07/07/2022 11:48, Ashok Reddy wrote:
> > - hosts: default
> >
> > ansible_user: cloud-user
> >
> > become: yes
> >
> > become_method: sudo
> >
> > gather_facts: true
> >
> >
> > Error:
> >
> > ERROR! 'ansible_user' is not a valid attribute for a Play
>
> Hello,
>
> the ansible_user needs to be set in the inventory.
>
> Regards
> Racke
>
> >
> > The error appears to be in '/root/modsec-compile.yml': line 2, column 3,
> but may
> >
> > be elsewhere in the file depending on the exact syntax problem.
> >
> >
> > The offending line appears to be:
> >
> >
> > ---
> >
> > - hosts: default
> >
> > ^ here
> >
> >
> >
> > On Thu, Jul 7, 2022 at 1:43 PM Stefan Hornburg (Racke) <[email protected]
> <mailto:[email protected]>> wrote:
> >
> > On 07/07/2022 10:05, Ashok Reddy wrote:
> > > the same issue happens even I have provided with -K argument:
> >
> > You need to login as the cloud-user and use privilege escalation (
> https://docs.ansible.com/ansible/latest/user_guide/become.html <
> https://docs.ansible.com/ansible/latest/user_guide/become.html>) to
> execute the tasks as root user.
> >
> > ansible_user: cloud-user
> > become: yes
> > become_method: sudo
> >
> > Regards
> > Racke
> >
> > >
> > > SSH password:
> > >
> > >
> > > PLAY [default]
> ********************************************************************************************************************************************************************************************
> > >
> > >
> > > TASK [Gathering Facts]
> ************************************************************************************************************************************************************************************
> > >
> > > 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
> ************************************************************************************************************************************************************************************************
> > >
> > > localhost:
> ok=0changed=0unreachable=1failed=0skipped=0rescued=0ignored=0
> > >
> > >
> > >
> > >
> > > On Thu, Jul 7, 2022 at 12:14 PM Prady A <[email protected]
> <mailto:[email protected]> <mailto:[email protected] <mailto:
> [email protected]>>> wrote:
> > >
> > > While executing the command provide -k option and provide the
> root password or
> > > Authenticate your localhost.
> > >
> > >
> > > On Thu, Jul 7, 2022 at 14:44, Ashok Reddy <
> [email protected] <mailto:[email protected]> <mailto:
> [email protected] <mailto:[email protected]>>> wrote:
> > >
> > > Hi all,
> > >
> > > I got the following error, while trying to execute
> ansible playbook:
> > >
> > > TASK [Gathering Facts]
> ************************************************************************************************************************************************************************************
> > >
> > > 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}
> > >
> > >
> > > --
> > > You received this message because you are subscribed to
> the Google Groups "Ansible Project" group.
> > > To unsubscribe from this group and stop receiving emails
> from it, send an email to [email protected]
> <mailto:ansible-project%[email protected]> <mailto:
> [email protected] <mailto:
> ansible-project%[email protected]>>.
> > > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f2a0e03c-b35f-47ee-afa6-0a1f8b907005n%40googlegroups.com
> <
> https://groups.google.com/d/msgid/ansible-project/f2a0e03c-b35f-47ee-afa6-0a1f8b907005n%40googlegroups.com>
> <
> https://groups.google.com/d/msgid/ansible-project/f2a0e03c-b35f-47ee-afa6-0a1f8b907005n%40googlegroups.com?utm_medium=email&utm_source=footer
> <
> https://groups.google.com/d/msgid/ansible-project/f2a0e03c-b35f-47ee-afa6-0a1f8b907005n%40googlegroups.com?utm_medium=email&utm_source=footer
> >>.
> > >
> > > --
> > > You received this message because you are subscribed to the
> Google Groups "Ansible Project" group.
> > > To unsubscribe from this group and stop receiving emails from
> it, send an email to [email protected] <mailto:
> ansible-project%[email protected]> <mailto:
> [email protected] <mailto:
> ansible-project%[email protected]>>.
> > > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap8rvefKQxLXiKkWLSJ2%2BNj%2Brk1SjZ%2Bx6SDFJMy%2Bc2Gqw%40mail.gmail.com
> <
> https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap8rvefKQxLXiKkWLSJ2%2BNj%2Brk1SjZ%2Bx6SDFJMy%2Bc2Gqw%40mail.gmail.com>
> <
> https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap8rvefKQxLXiKkWLSJ2%2BNj%2Brk1SjZ%2Bx6SDFJMy%2Bc2Gqw%40mail.gmail.com?utm_medium=email&utm_source=footer
> <
> https://groups.google.com/d/msgid/ansible-project/CAEuB3Ap8rvefKQxLXiKkWLSJ2%2BNj%2Brk1SjZ%2Bx6SDFJMy%2Bc2Gqw%40mail.gmail.com?utm_medium=email&utm_source=footer
> >>.
> > >
> > > --
> > > You received this message because you are subscribed to the
> Google Groups "Ansible Project" group.
> > > To unsubscribe from this group and stop receiving emails from it,
> send an email to [email protected] <mailto:
> ansible-project%[email protected]> <mailto:
> [email protected] <mailto:
> ansible-project%[email protected]>>.
> > > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAKRLcHjW%3DGa3VVyVKyrG07z8L2BDFewh31ZzYJMPQGjQZTvU6g%40mail.gmail.com
> <
> https://groups.google.com/d/msgid/ansible-project/CAKRLcHjW%3DGa3VVyVKyrG07z8L2BDFewh31ZzYJMPQGjQZTvU6g%40mail.gmail.com>
> <
> https://groups.google.com/d/msgid/ansible-project/CAKRLcHjW%3DGa3VVyVKyrG07z8L2BDFewh31ZzYJMPQGjQZTvU6g%40mail.gmail.com?utm_medium=email&utm_source=footer
> <
> https://groups.google.com/d/msgid/ansible-project/CAKRLcHjW%3DGa3VVyVKyrG07z8L2BDFewh31ZzYJMPQGjQZTvU6g%40mail.gmail.com?utm_medium=email&utm_source=footer
> >>.
> >
> >
> > --
> > Automation expert - Ansible and friends
> > Linux administrator & Debian maintainer
> > Perl Dancer & conference hopper
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send an email to [email protected] <mailto:
> ansible-project%[email protected]>.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a65055de-28a1-4cee-be35-5d8de90bbc81%40linuxia.de
> <
> https://groups.google.com/d/msgid/ansible-project/a65055de-28a1-4cee-be35-5d8de90bbc81%40linuxia.de
> >.
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected] <mailto:
> [email protected]>.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAKRLcHhm78xq7BdvyiczW4bi6cML38pExOiODuER_7yxMbR_tQ%40mail.gmail.com
> <
> https://groups.google.com/d/msgid/ansible-project/CAKRLcHhm78xq7BdvyiczW4bi6cML38pExOiODuER_7yxMbR_tQ%40mail.gmail.com?utm_medium=email&utm_source=footer
> >.
>
>
> --
> Automation expert - Ansible and friends
> Linux administrator & Debian maintainer
> Perl Dancer & conference hopper
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/82d67549-add1-7949-9f03-299b95e6a1cd%40linuxia.de
> .
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAKRLcHgYaHMp%2B15jZsVP%2BjRODHiRabomDjbb_%3DdAj4xrepTy5w%40mail.gmail.com.