I tried running this very verbose command: ansible -vvv -m setup XXX
which caused the following to be output (among other things): <rpi2-tv.38gr.net> 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'"'"'' which prompted me to cut out Ansible altogether and just try this: $ ssh osmc@XXX /bin/sh -c '"echo $PATH"' OSMC: Open Source Media Center osmc@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 Center osmc@XXX's password: /usr/local/bin:/usr/bin:/bin:/usr/games which is a very different PATH to when I log in interactively: $ ssh osmc@XXX OSMC: Open Source Media Center osmc@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 So on the bright side, it doesn't seem to be an Ansible problem after all, which means it's probably out of scope for this discussion group. Time to read up on the differences between interactive, non-interactive, login and non-login bash sessions, it seems... Thanks anyway for all of your attention to this point. I'm sorry to have wasted your time. -- 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-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/db67d471-c38e-4fc5-9d6f-eba18e070f1a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.