Hi,
I was trying do install grails using gvm via ansible just like you today.
After battling for a few hours with it, I ended up stumbling upon the
discussion about getting a remote user's environment using sudo where the
last comment has a solution.
So I now I rap all my shell calls in 'bash -lc' to get the remote user's
> environment set-uip properly. For instance :
> - shell: cd; bash -lc "rbenv install {{ ruby_version }}"
https://groups.google.com/d/msg/ansible-project/cNgOQm-zF0U/vZ4ZBl8Z8QYJ
Here's what my task file looks like for the grails part (it also has a
solution for the prompting the gvm install grails confirmation dialog –
just pipe it into yes see man yes):
# grails
- name: check if gvm is installed
shell: test -d /usr/share/tomcat/.gvm && echo "yes" || echo "no"
register: is_gvm_installed
- name: download gvm
when: is_gvm_installed.stdout == "no"
get_url: url=http://get.gvmtool.net dest=/usr/share/tomcat/gvm_install.sh
remote_user: tomcat
- name: install gvm
when: is_gvm_installed.stdout == "no"
command: bash /usr/share/tomcat/gvm_install.sh
sudo: yes
sudo_user: tomcat
- name: install grails
# probably not the most elegant way to have .bashrc sourced but that'll
do for now...
shell: bash -lc "gvm install grails | yes" executable=/bin/bash
chdir=/usr/share/tomcat/
sudo: yes
sudo_user: tomcat
Cheers,
rx
On Sunday, November 30, 2014 6:53:27 PM UTC+1, Tze Yang Ng wrote:
>
> Hi,
>
> I managed to get further with the following:
>
> - name: Set Home | Set to vagrant home before install Grails
> shell:
> cd /home/vagrant executable: /bin/bash
> sudo: no
> tags: grails
>
> - name: gvm | Install gvm prerequisites for Grails
> shell:
> curl -s get.gvmtool.net | bash executable: /bin/bash
> sudo: no
> tags: grails
>
> - name: gvm set source | Set source for gvm
> shell:
> source "/home/vagrant/.gvm/bin/gvm-init.sh" executable: /bin/bash
> sudo: no
> tags: grails
>
> - name: grails | install grails 2.3.7
> shell:
> gvm install grails 2.3.7 executable: /bin/bash
> sudo: yes
> tags: grails
>
>
> but it still failed at the last command: gvm install
>
> TASK: [grails | install grails 2.3.7]
> *****************************************
>
> failed: [default] => {"changed": true, "cmd": "gvm install grails 2.3.7",
> "delta": "0:00:00.003756", "end": "2014-11-30 17:43:51.951141", "rc": 127,
> "start": "2014-11-30 17:43:51.947385", "warnings": []}
>
> stderr: /bin/bash: gvm: command not found
>
> FATAL: all hosts have already failed -- aborting
>
>
> Any advice? Also how to press "y" at the end of the installation using
> playbook?
> thanks.
>
>
> On Wednesday, November 26, 2014 11:18:00 PM UTC-6, Tze Yang Ng wrote:
>>
>> Hi,
>>
>> Trying to use ansible to install GVM and Grails, but can't seem to make
>> it work, anyone can help? Tried both shell and command, but none seem work.
>>
>> - name: gvm | Install gvm prerequisites for Grails
>> shell:
>> curl -s get.gvmtool.net | bash
>> sudo: yes
>> tags: grails
>> - name: gvm set source | Set source for gvm
>> shell:
>> source "/home/vagrant/.gvm/bin/gvm-init.sh"
>> sudo: yes
>> tags: grails
>> - name: grails | install grails 2.3.7
>> command:
>> gvm install grails 2.3.7
>> sudo: yes
>> tags: grails
>>
>> thanks.
>>
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/1007080b-7634-4345-8128-46d8b698a993%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.