Hi there before all thanks fot the amazing work that you already doneIs only one thing that keep make me noise when I use Ansible, normally I use RVM to handle different versions of ruby and every time that i need to run a simple bundle to install al the gems from every app I get struggled with itfailed: [ingenyo] => {"changed": true, "cmd": "bundle", "delta": "0:00:00.002008", "end": "2015-05-02 16:08:49.070874", "rc": 127, "start": "2015-05-02 16:08:49.068866", "warnings": []}stderr: /bin/sh: 1: bundle: not foundFATAL: all hosts have already failed -- aborting
I know that is because is a login shell command and ansible don't use that, but how is the Pretty way to fix that problems? I'm down to help in anything that is necessary for thathere my 2 playbooks!Deploy.yml- name: Clone repositoriogit: repo=https://github.com/mullerivan/myapp.git dest=/home/vagrant/myapp accept_hostkey=yessudo: false- name: bundle install (install the rest of the gems)shell: bundlechdir=/home/vagrant/myappsudo: false
rvm.yml- name: downloading the GPG signatureshell: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3- name: Installing rvm ruby and rails take 16m5.124s up to your internet conectionshell: \curl -sSL https://get.rvm.io | bash -s stable --rails
# Ruby from source playbook (https://github.com/jgrowl/ansible-playbook-ruby-from-src)- name: upgradeaction: apt update_cache=yes upgrade=yes- name: install ruby dependenciesaction: apt pkg={{item}} state=installed
with_items:- build-essential- automake- bison- autoconf- pkg-config- libreadline6- libreadline6-dev- openssl- libssl-dev- curl- git-core- zlib1g- zlib1g-dev- libyaml-dev- libsqlite3-dev- libxml2-dev- libxslt1-dev- curl- name: Install app dependenciesaction: apt pkg={{item}} state=installed
On Monday, May 4, 2015 at 4:13:13 PM UTC+3, Ivan Müller wrote:Hi there before all thanks fot the amazing work that you already doneIs only one thing that keep make me noise when I use Ansible, normally I use RVM to handle different versions of ruby and every time that i need to run a simple bundle to install al the gems from every app I get struggled with itfailed: [ingenyo] => {"changed": true, "cmd": "bundle", "delta": "0:00:00.002008", "end": "2015-05-02 16:08:49.070874", "rc": 127, "start": "2015-05-02 16:08:49.068866", "warnings": []}stderr: /bin/sh: 1: bundle: not foundFATAL: all hosts have already failed -- aborting
Are you sure you already have bundler installed when you execute this? This error shows that it's not found on remote host.
I know that is because is a login shell command and ansible don't use that, but how is the Pretty way to fix that problems? I'm down to help in anything that is necessary for thathere my 2 playbooks!Deploy.yml- name: Clone repositoriogit: repo=https://github.com/mullerivan/myapp.git dest=/home/vagrant/myapp accept_hostkey=yessudo: false- name: bundle install (install the rest of the gems)shell: bundlechdir=/home/vagrant/myappsudo: false
Another thing that might create you further issues: you suppose you need an argument to "bundle", e.g. "bundle install" (no quotes).
rvm.yml- name: downloading the GPG signatureshell: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3- name: Installing rvm ruby and rails take 16m5.124s up to your internet conectionshell: \curl -sSL https://get.rvm.io | bash -s stable --rails
The backslash before curl -- why do you need that?
# Ruby from source playbook (https://github.com/jgrowl/ansible-playbook-ruby-from-src)- name: upgradeaction: apt update_cache=yes upgrade=yes- name: install ruby dependenciesaction: apt pkg={{item}} state=installed
I think latest apt syntax requires "state=present" (no quotes)
with_items:- build-essential- automake- bison- autoconf- pkg-config- libreadline6- libreadline6-dev- openssl- libssl-dev- curl- git-core- zlib1g- zlib1g-dev- libyaml-dev- libsqlite3-dev- libxml2-dev- libxslt1-dev- curl- name: Install app dependenciesaction: apt pkg={{item}} state=installed
same here ("state=present")
HTH,
-Y.
Hello,
if you have access to private Debian repositories I would suggest to leave the git clone and bundler part to some ci server and create a deb package from you application using fpm as packaging tool.
Use bundle install with a local vendor path, this way all gems are installed in you application directory.
It will heavily reduce your 16 minutes deployment. And you may have to install less dev packages in production..
Regards,
Marcus
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/mU2E-d2mw4o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFRuYVdpEbOP2X4piFaZdB_DKNNANMbvu7OmK-sC2g-tKVtisw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Hi Yassen. I already solved it with that wrapperCode:- name: bundle install (install the rest of the gems)shell: /usr/local/rvm/wrappers/default/bundlechdir={{rails_app_path}}sudo: falseI just want to know how is the proper way to use ansible in this case, would be nice that ansible can just detect the shell login on chdir={{rails_app_path}}, let me do just bundle(if a go by ssh to the server and run just bundle that works, why ansible cant do that?)
Thanks for you time and your answers :)