I'm trying to bootstrap a rails dev environment with ansible on Ubuntu 14.04, using rbenv to handle managing ruby versions. I have a playbook that does various things that work successfully but I've taken out the relevant parts in this gist
Upon running this task:
- name: Install ruby with rbenv
sudo_user: "{{ username }}"
#command: rbenv install {{ ruby_version }}
command: zsh -lc "rbenv install {{ ruby_version }}"
I get the following error
failed: [localhost] => {"changed": true, "cmd": ["zsh", "-lc", "rbenv install 2.1.2"], "delta": "0:00:00.005791", "end": "2015-04-21 09:31:19.184810", "rc": 127, "start": "2015-04-21 09:31:19.179019"}
stderr: zsh:1: command not found: rbenv
All previous tasks are successful, including getting For some reason upon running this I get an error that rbenv is not installed.
You can see I commented out just using "rbenv install" because someone suggested that since rbenv counts on your certain things being in your .bashrc
(or .zshrc
in my case) you need to run it with the shell. But this didn't work either.
I also tried adding a task to restart my shell using the raw
module. And I tried running with shell
instead of command
.
Here's my zshrc in case that's relevant.
I checked this answer but they just mentioned a problem with using "when" with newer version. Also no one answered this question, which is similar.