- name: ensure Vim is installedapt: name=vim state=present
TASK: [vim | ensure Vim is installed] *****************************************failed: [XXX] => {"failed": true}stderr: E: Sub-process /usr/bin/dpkg returned an error code (2)stdout: Reading package lists......dpkg: warning: 'ldconfig' not found in PATH or not executabledpkg: warning: 'start-stop-daemon' not found in PATH or not executabledpkg: error: 2 expected programs not found in PATH or not executableNote: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbinmsg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'vim'' failed: E: Sub-process /usr/bin/dpkg returned an error code (2)
$ which ldconfig start-stop-daemon/sbin/ldconfig/sbin/start-stop-daemon$ echo $PATH/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/opt/vc/bin$ sudo sh -c 'echo $PATH'/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/opt/vc/bin
$ ansible -m setup XXX...XXX | success >> {"ansible_facts": {..."ansible_env": {..."PATH": "/usr/local/bin:/usr/bin:/bin:/usr/games",..."USERNAME": "root"},...},"changed": false}
The first one I would look at is sudo (/etc/sudoers), as it normally
resets all env variables for a user.
Defaults env_resetDefaults mail_badpassDefaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"root ALL=(ALL:ALL) ALL%sudo ALL=(ALL:ALL) ALLDefaults env_keep += "RPI_UPDATE_UNSUPPORTED"Defaults !secure_path
$ echo $PATH/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/opt/vc/bin
$ sudo su# echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
On Fri, 8 May 2015 11:55 pm Brian Coca <bc...@ansible.com> wrote:
try: sudo sh -c 'echo $PATH'
su can readd path info, the above is closer to what ansible does (it
uses sudo -u <user> not sudo su).
$ sudo sh -c 'echo $PATH'
try: sudo sh -c 'echo $PATH'
su can readd path info, the above is closer to what ansible does (it
uses sudo -u <user> not sudo su).
$ sudo sh -c 'echo $PATH'
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/opt/vc/bin
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/zl6l6i0bBMc/unsubscribe.
To unsubscribe from this group and all its topics, 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/7c065f56-33bc-4cc9-9a00-9629e054b746%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Alex,
if you are looking for problems with sudo you can login as your ansible user and issue "sudo -l". This will list all commands your ansible user is allowed to use.
From your sudo config files, %sudo group can fire all kind of commands, but needs a password. That's by intention?
Regards,
Marcus
Would giving you SSH access to this particular machine be useful?
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/zl6l6i0bBMc/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAJ5XC8nAC4hiPPs-C9aVE7sN2VSXQHwheKvf_GqTyY-6uHSe1A%40mail.gmail.com.
if you are looking for problems with sudo you can login as your ansible user and issue "sudo -l". This will list all commands your ansible user is allowed to use.
$ sudo -lMatching Defaults entries for osmc on osmc:env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, env_keep+=RPI_UPDATE_UNSUPPORTED, !secure_pathUser osmc may run the following commands on osmc:(root) NOPASSWD: ALL
From your sudo config files, %sudo group can fire all kind of commands, but needs a password. That's by intention?
ansible -vvv -m setup XXX
<XXX> EXEC sshpass -d6 ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=".../.ansible/cp/ansible-ssh-%h-%p-%r" -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=osmc -o ConnectTimeout=10 XXX /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=xidpkckjjfdcsgiewleebdlstyiyzpad] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-xidpkckjjfdcsgiewleebdlstyiyzpad; LANG=C LC_CTYPE=C /usr/bin/python /home/osmc/.ansible/tmp/ansible-tmp-1431605612.35-230680545785241/setup; rm -rf /home/osmc/.ansible/tmp/ansible-tmp-1431605612.35-230680545785241/ >/dev/null 2>&1'"'"''
$ ssh osmc@XXX /bin/sh -c '"echo $PATH"'OSMC: Open Source Media Centerosmc@XXX's password:/usr/local/bin:/usr/bin:/bin:/usr/games
$ ssh osmc@XXX /usr/bin/sudo -u root /bin/sh -c '"echo $PATH"'OSMC: Open Source Media Centerosmc@XXX's password:/usr/local/bin:/usr/bin:/bin:/usr/games
$ ssh osmc@XXXOSMC: Open Source Media Centerosmc@XXX's password:osmc@XXX:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/opt/vc/bin
osmc@XXX:~$ sudo echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/opt/vc/bin
ssh user@host -t "sudo bash -l -c 'echo \$PATH'"