--- - name: Update APT cache apt: update_cache=yes become: true when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - name: Retrieve the number of cores that are available for compilation command: nproc register: cores - name: Install APT prerequisite packages that are necessary to compile applications and gems with native extensions apt: pkg={{ item }} become: true with_items: - autoconf - build-essential when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - name: Install yum prerequisite packages that are necessary to compile applications and gems with native extensions yum: name="{{ item }}" become: true with_items: - autoconf - "@Developer tools" when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' or ansible_distribution == 'Amazon' - name: Install APT Ruby dependencies become: true apt: pkg={{ item }} state=present with_items: "{{ ruby_apt_dependencies }}" when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - name: Install yum Ruby dependencies become: true yum: name={{ item }} with_items: "{{ ruby_yum_dependencies }}" when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' or ansible_distribution == 'Amazon' - name: Download the Ruby source code get_url: url={{ ruby_download_location }} dest=/usr/local/src/ checksum={{ ruby_checksum }} become: true - name: Generate the Ruby installation script template: src=install-ruby.j2 dest=/usr/local/src/install-ruby.sh owner=root group=root mode=700 become: true - name: Run the Ruby installation script command: /usr/local/src/install-ruby.sh creates={{ ruby_location }}/bin/ruby become: true - name: Generate the script that allows you to easily run Rake tasks with the correct RAILS_ENV environment variable, and the wrapper script that contains GC settings template: src={{ item }}.j2 dest=/usr/local/bin/{{ item }} owner=root group=root mode=755 become: true with_items: - rake-env - ruby-gc-wrapper - name: Update rubygems command: "{{ ruby_location }}/bin/gem update --system" become: true - name: Install/update Bundler shell: "{{ ruby_location }}/bin/gem install bundler -v {{ bundler_version }}" become: true - name: Make Ruby symlinks file: path=/usr/local/bin/{{ item }} src={{ ruby_location }}/bin/{{ item }} state=link become: true with_items: "{{ ruby_symlinks }}" - name: Grab Ruby version shell: ruby --version register: stats_ruby_version when: send_stats == true and stats_url is defined and stats_api_key is defined tags: - maintenance - stats - name: Send Ruby stats to URL uri: url: "{{stats_url}}" method: POST headers: X-API-Version: 1 X-Client-Api-key: "{{stats_api_key}}" body_format: json body: client_stat: key: ruby_version value: "{{stats_ruby_version.stdout}}" hostname: "{{hostname}}" when: send_stats == true and stats_url is defined and stats_api_key is defined tags: - maintenance - stats