On Monday, February 9, 2015 at 9:32:31 PM UTC+1, Dick Davies wrote:
>
> Hi Adam
>
> comments inline.
>
> ( TL;DR:
>
> * good work on the troubleshooting!
> * I think you're right, this is likely an environment/path thing.
> * Ansible 1.4 is ancient, that probably isn't helping.
> * there's an executable parameter you can use to hardcode the gem
> command to run.
> )
>
> On 9 February 2015 at 16:52, Adam Hamsik <[email protected] <javascript:>>
> wrote:
> > Hi,
> >
> > I can see this behaviour with following gems
> >
> > github: haste
> > rubygems: ops_build
> >
> > opsci:~ $ sudo gem list
> >
> > *** LOCAL GEMS ***
>
> First question: are you sure this is the same gem binary Ansible is
> driving?
> sudo can sometimes do odd things with env. variables etc, so i'd 'sudo
> -i' and then
> check 'which gem' and check the environment.
>
> > TASK: [common-server | Install Haste client binary]
> > ***************************
> > <opsci.rsd.com> ESTABLISH CONNECTION FOR USER: rsd
> > <opsci.rsd.com> REMOTE_MODULE gem name=haste state=latest
> > <opsci.rsd.com> EXEC ssh -C -tt -q -o ControlPersist=15m -F
> > /Users/haad/.ansible/ssh_config -o
> > ControlPath="/Users/haad/.ansible/cp/ansible-ssh-%h-%p-%r" -o
> > StrictHostKeyChecking=no -o Port=22 -o
> > IdentityFile="/Users/haad/.ssh/id_rsa" -o
> KbdInteractiveAuthentication=no -o
> >
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=rsd -o ConnectTimeout=19 opsci.rsd.com
> > /bin/sh -c 'mkdir -p
> > $HOME/.ansible/tmp/ansible-tmp-1423500136.86-230822911136757 && chmod
> a+rx
> > $HOME/.ansible/tmp/ansible-tmp-1423500136.86-230822911136757 && echo
> > $HOME/.ansible/tmp/ansible-tmp-1423500136.86-230822911136757'
> > <opsci.rsd.com> PUT
> > /var/folders/yq/_h9bmb6x1qxb7p4_w5xhkgx80000gn/T/tmp1sQb3z TO
> > /home/rsd/.ansible/tmp/ansible-tmp-1423500136.86-230822911136757/gem
> > <opsci.rsd.com> EXEC ssh -C -tt -q -o ControlPersist=15m -F
> > /Users/haad/.ansible/ssh_config -o
> > ControlPath="/Users/haad/.ansible/cp/ansible-ssh-%h-%p-%r" -o
> > StrictHostKeyChecking=no -o Port=22 -o
> > IdentityFile="/Users/haad/.ssh/id_rsa" -o
> KbdInteractiveAuthentication=no -o
> >
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=rsd -o ConnectTimeout=19 opsci.rsd.com
> > /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible,
> > key=bqhjegrwqcfakjiubogaofvswknlictj] password: " -u root /bin/sh -c
> > '"'"'echo SUDO-SUCCESS-bqhjegrwqcfakjiubogaofvswknlictj; LANG=C
> LC_CTYPE=C
> > /usr/bin/python
> > /home/rsd/.ansible/tmp/ansible-tmp-1423500136.86-230822911136757/gem; rm
> -rf
> > /home/rsd/.ansible/tmp/ansible-tmp-1423500136.86-230822911136757/
> >/dev/null
> > 2>&1'"'"''
> > ok: [opsci-server] => {"changed": false, "name": "haste", "state":
> "latest",
> > "version": "0.2.1"}
> >
> > On Tuesday, November 19, 2013 at 7:17:21 PM UTC+1, Adam Williams wrote:
> >>
> >> I am running Ansible using "brew install --HEAD ansible", which
> currently
> >> prints it's version as "ansible 1.4".
> >>
> >> Here is my task:
> >>
> >> - name: install ruby gem bundler
> >> gem: name=bundler state=present version=1.3.5 user_install=no
> >> sudo: true
>
> That looks ok - you can also set executable=... if you want to ensure you
> know
> which 'gem' binary to use.
>
> >> When I run, it states that there is no change - bundler appears to the
> gem
> >> module to be installed??, though it is not.
> >>
> >> I went further and tried the following:
> >>
> >> ansible utilities -v --sudo -i development -m gem -a 'name=bundler
> >> state=present version=1.3.5 user_install=no'
> >>
> >> 192.168.10.24 | success >> {
> >>
> >> "changed": false,
> >>
> >> "name": "bundler",
> >>
> >> "state": "present",
> >>
> >> "version": "1.3.5"
> >>
> >> }
> >>
> >>
> >> Seemingly the same behavior. If I run without --sudo:
> >>
> >> ansible utilities -v -i development -m gem -a 'name=bundler
> state=present
> >> version=1.3.5 user_install=no'
> >>
> >> 192.168.10.24 | FAILED >> {
>
> That makes sense as you no longer have permissions to write to system
> folders.
>
>
> One last thing - you are going to be a lot better off not using 1.4,
> it's pretty old.
> A straight github checkout works great for me on OS X, so it might be
> worth
> avoiding homebrew.
>
Just for the record problem was in user_install default value. Which by
default installs gems to root home and not to global cache.
After removing gems adn running play with following module attr it works
like a charm.
gem: name={{item}} state=latest include_dependencies=yes user_install=no
--
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/cce59957-b089-47c8-9bd4-a7b1d7a9bbc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.