I\'m trying to install the Kiex Version manager for the Elixir programming language using Ansible.
These are the plays I use for this:
- name: Kiex Insta
Just use the full, absolute path, like you tried in the Install Elixir Version
task, but mind that you have a typo, both, in the example and in the explanation you posted:
command: /home/deoployer/.kiex/bin/kiex list
[ ] even the
/home/deoployer/.kiex/bin/kiex list
[ ] fail[s]
It should likely be deployer
, like in the first play, not deoployer
.
There is no reason otherwise for Ansible to fail with "kiex: not found" message, if you provide the correct path.
Explanations regarding other tasks:
Quoting man bash
:
When an interactive shell that is not a login shell is started, bash reads and executes commands from
~/.bashrc
, if that file exists.
So your ~/.bashrc
is not even read when you execute tasks with Ansible, because it's not an interactive session.
This is for example why your pathul
variable does not contain changes applied in the ~/.bashrc
.
The following two tasks run separate bash processes. The environment sourced in the first task has no influence on the environment of the second:
- name: Reload Path
shell: source /home/deployer/.bashrc
args:
executable: /bin/bash
- shell: echo $PATH
register: pathul