Sourcing a file before executing commands in Ansible
I am trying to install node js version using nvm using below Ansible yml file. I get error like source "source /home/centos/.nvm/nvm.sh" file not found. But if I do the same by logging into the machine using ssh then it works fine. - name: Install nvm git: repo=https://github.com/creationix/nvm.git dest=~/.nvm version={{ nvm.version }} tags: nvm - name: Source nvm in ~/.profile lineinfile: > dest=~/.profile line="source ~/.nvm/nvm.sh" create=yes tags: nvm - name: Install node {{ nvm.node_version }} command: "{{ item }}" with_items: - "source /home/centos/.nvm/nvm.sh" - nvm install {{ nvm.node