On 12/10/2013 12:01 PM, Adam Williams wrote:
Wow, somehow I totally missed this reply. Thank you for responding. Sorry for the terrible formatting of my post. I'll consider your suggestion and update this thread once I have an answer. Again, very strange that it works fine when I leave the module on the server, login there, and execute it (the python script).

On Tuesday, November 19, 2013 5:25:11 PM UTC-5, Michael DeHaan wrote:

    Perhaps there is some way the install process for bundler is done
    very differently than other gems?




    On Tue, Nov 19, 2013 at 1:17 PM, Adam Williams <[email protected]
    <javascript:>> 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

        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 >> {

            "cmd": [

        "/usr/bin/gem",

        "install",

        "--version",

                "1.3.5",

        "--include-dependencies",

        "--no-user-install",

        "--no-rdoc",

        "--no-ri",

                "bundler"

            ],

            "failed": true,

            "msg": "ERROR:  While executing gem ...
        (Gem::FilePermissionError)\n    You don't have write
        permissions into the /var/lib/gems/1.9.1 directory.",

            "rc": 1,

            "stderr": "ERROR:  While executing gem ...
        (Gem::FilePermissionError)\n    You don't have write
        permissions into the /var/lib/gems/1.9.1 directory.\n",

            "stdout": "INFO:  `gem install -y` is now default and will
        be removed\nINFO:  use --ignore-dependencies to install only
        the gems you list\n"

        }


        I made the effort of running the "gem" module manually on the
        target host by setting ANSIBLE_KEEP_REMOTE_FILES=true and then
        running "sudo /usr/bin/python
        /home/vagrant/.ansible/tmp/ansible-1384877605.76-187131457818350/gem".
        That worked great by installing bundler.

        I have also made an attempt to discover what the "gem" python
        script is doing in the filesystem during a playbook run and
        during a manual run, as described, by using auditd. You can
        see the output over here:
        https://gist.github.com/aiwilliams/a86bf5d3deee57f2c72d
        <https://gist.github.com/aiwilliams/a86bf5d3deee57f2c72d>.
        Seems to me they're both working with the same directories,
        but otherwise I didn't get much indication why it behaves
        differently when executed by ansible-playbook.

        It's got to be an environment thing, I would have though, but
        it seems that the bash environment is the same and I've
        verified that the gem environment is the same.

        Any clues what might be going on?

        Thanks, Adam
-- 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]
        <javascript:>.
        For more options, visit
        https://groups.google.com/groups/opt_out
        <https://groups.google.com/groups/opt_out>.




-- Michael DeHaan <[email protected] <javascript:>>
    CTO, AnsibleWorks, Inc.
    http://www.ansibleworks.com/

--
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].
For more options, visit https://groups.google.com/groups/opt_out.


Also keep in mind that ansible runs "/bin/sh -c python <scriptfile>" for modules on the client nodes, and will only have environment variables that have been specified by "environment:" on the task. http://www.ansibleworks.com/docs/playbooks_environment.html

--
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to