I put in this task to make sure secure_path is used. It is now part of my
"set the node up for use with ansible" playbook:
- name: Special for osmc. Make sure secure_path is honored
file: path=/etc/sudoers.d/osmc-no-secure-path state=absent
There is a discussion on this in the osmc forum where one of the developers
says this is not something they support officially but there shouldn't be
any issues and so far I haven't had any. (I had this already set up before
the last major osmc Update)
https://discourse.osmc.tv/t/system-path-broken-when-running-a-non-interactive-sudo-command/4167/6
There is also another workaround in the thread where the PATH env is set as
part of the task
On Monday, 4 May 2015 15:13:09 UTC+2, Alex Peters wrote:
>
> I'm trying to install a package on a system running a Debian Jessie-based
> distribution called OSMC <https://osmc.tv/>.
>
> This task (run with ansible_sudo == true):
>
> - name: ensure Vim is installed
> apt: name=vim state=present
>
>
> causes this to happen:
>
> 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 executable
> dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
> dpkg: error: 2 expected programs not found in PATH or not executable
> Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and
> /sbin
>
> msg: '/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)
>
>
> It seems that something is mangling the PATH before apt-get is called,
> because if I SSH manually into this system:
>
> $ 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
>
>
> the PATH is correct and I have no problem installing the package manually.
>
> What can I do to improve this situation?
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/6c5abfd8-62db-4861-ad82-857ae499954b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.