[ansible-project] Can't understand output

81 views
Skip to first unread message

Paul Letskiy

unread,
Dec 4, 2014, 12:43:03 PM12/4/14
to ansible-project
Hello,

I'm trying Ansible without playbooks. Just oneliner from console. Want to do 'apt-get update' on remote server. 

Here is ansible.cfg:

[defaults]
remote_port = 2224
remote_user = che
sudo_user = che

Here is command:

>ansible my.domain.com -vvvv -S -m apt -a update_cache=yes

Che in sudo users on my.domain.com machine and can perform commands without password. 

Here is command output:

<my.domain.com> ESTABLISH CONNECTION FOR USER: che
<my.domain.com> REMOTE_MODULE apt update_cache=yes
<my.domain.com> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/che/.ansible/cp/ansible-    ssh-%h-%p-%r" -o Port=2224 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased    ,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 my.domain.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1    417710259.52-145934245462641 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1417710259.52-145934245462641 && echo $HOME/.ansible/t    mp/ansible-tmp-1417710259.52-145934245462641'
<my.domain.com> PUT /var/folders/5t/3h0pmhsj0m1_ry0kdwq9jg5h0000gn/T/tmpF2t29z TO /home/che/.ansible/tmp/ansible-tmp-1417710259.    52-145934245462641/apt
<my.domain.com> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/che/.ansible/cp/ansible-    ssh-%h-%p-%r" -o Port=2224 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased    ,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 my.domain.com /bin/sh -c 'su root -c "/bin/sh -c '"'"'echo SUDO-SUC    CESS-mtfrixxottefdaxagqopjyeswrarmlxn; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/che/.ansible/tmp/ansible-tmp-    1417710259.52-145934245462641/apt; rm -rf /home/che/.ansible/tmp/ansible-tmp-1417710259.52-145934245462641/ >/dev/null 2>&1'"'"'    "'

And just get stuck. Is it normal, or I must find where is a problem?

--
Best regards,
Pavel "Che" Letskiy

James Cammarata

unread,
Dec 4, 2014, 1:10:38 PM12/4/14
to ansible...@googlegroups.com
Hi Paul,

Looking at your options you've not specified any action for apt to take beyond updating the cache (the only -a option you show is "update_cache=yes"), which itself should be an error. I believe you want to add "upgrade=safe", so please let us know if it still hangs after adding that.


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CALxmVWbvL3yi2RxDUv44MFT2wt-zu6jccmngPUexL0h0d8CNcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Paul Letskiy

unread,
Dec 4, 2014, 2:00:05 PM12/4/14
to ansible-project
Thank you for your answer!

Looks like sudo problems:

"msg": "'/usr/bin/aptitude safe-upgrade' failed: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)\nE: Unable to lock the administration directory (/var/lib/dpkg/), are you root?\n",

But my user is sudo user with NOPASSWD. And I can do "apt-get update" or "apt-get safe-upgrade" on server without any problems.


For more options, visit https://groups.google.com/d/optout.

James Cammarata

unread,
Dec 4, 2014, 2:08:59 PM12/4/14
to ansible...@googlegroups.com
I see you're using "-S", which is --su. You will want to use -s or --sudo instead.

Paul Letskiy

unread,
Dec 4, 2014, 2:13:07 PM12/4/14
to ansible-project
Sorry, it's old command. I've tried -s already. Same thing.


For more options, visit https://groups.google.com/d/optout.



--
С уважением,
Павел "Che" Лецкий

tkuratomi

unread,
Dec 4, 2014, 3:33:08 PM12/4/14
to ansible...@googlegroups.com

from your first email I see that you have:
sudo_user = che

in your defaults file.  That's likely the source of this portion of the issue.  sudo_user means "the user that you want to sudo to".  So you want it to be root (which is the default so you should be fine if you just get rid of that line).

You were probably thinking that you needed to specify the user to sudo from.  In ansible the user that you sudo from is the user that ansible is ssh'ing into the box as.  In your defaults you're setting remote_user=che so that's the user that will be sudo'd from.

-Toshio

Paul Letskiy

unread,
Dec 4, 2014, 3:58:04 PM12/4/14
to ansible-project
I just found it too :))
Thank you, Toshio, anyway!

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages