Hi everyone,
i am currently experiencing some newbie problems, i think.
I want to execute ansible with an ad-hoc command so that each machine fetches the latest version of my dotfiles which are managed by mr and vcsh.
So the command i am executing is:
ansible all -a “mr up”
which works pretty well on all my linux boxes, but not on my Mac hosts. On one imac i get an “[Errno 2] No such file or directory”, which is strange, because of the following investigation i made:
- The command “mr up” executes just fine when i log on interactively via ssh and execute it.
- So i have told ansible to not delete its tmp files, and tried to execute the command in interactive session by calling “python ~/.ansible/tmp/ansible-yada-yada-1234/command” which works fine
- So maybe ansible does not load up the zsh environment i normally use when i work interactively on this machine. Let’s check the shell ansible uses: ‘ansible imac -a “echo $SHELL”’ results in zsh. Fine.
- To check if there is some kind of PATH-loading issues, i execute the mr command specifying its full path: ‘ansible imac -a “/usr/local/bin/mr up”’ works fine, but fails to execute vcsh, which is also installed in /usr/local/bin via Homebrew. So maybe the PATH which ansible works with does not have /usr/local/bin in it.
- So let’s check how the PATH looks like when ansible logs on onto this host: ‘ansible imac -a “echo $PATH”’ reveals that /usr/local/bin is indeed in the PATH, and the binaries in it should be visible by ansible.
- Last check: Maybe ‘mr up’ has some problems when called in an non-interactive shell. Let’s check it by calling “ssh imac ‘mr up’” → Works.
So i have this problem that ansible cannot execute an ad-hoc command, because it cannot find it, despite loading its directory in the PATH, and despite it working normally when executing the command via interactive ssh, or plain ssh at all.
You see, i could use some help here.
Thanks in advance.