-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
48 lines (48 loc) · 1.36 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- name: ruby
hosts: all
gather_facts: False
tasks:
- name: set vars
set_fact:
is_amazon_ebs: "{{ build_type == 'amazon-ebs' }}"
major_version: "{{ version | regex_replace('.\\d$', '') }}"
- name: install packages
become: "{{ is_amazon_ebs }}"
yum: name={{ item }} state=present
with_items:
# for ruby
- gcc
- openssl-devel
- readline-devel
- zlib-devel
# major native gems
- mysql-devel
- postgresql-devel
- sqlite-devel
- ImageMagick-devel
- name: clean yum cache
become: "{{ is_amazon_ebs }}"
command: yum clean all
- name: unarchive ruby tarball
unarchive:
src: https://cache.ruby-lang.org/pub/ruby/{{ major_version }}/ruby-{{ version }}.tar.gz
dest: .
remote_src: True
- name: install ruby
command: "{{ item }} chdir=ruby-{{ version }} "
with_items:
- ./configure --prefix=/tmp/usr
- make install
- name: install native gems
command: "/tmp/usr/bin/gem install --no-document {{ item }}"
with_items:
- mysql2
- pg
- sqlite3
- rmagick
- name: archive installed ruby dir
command: tar czf dest.tar.gz -C /tmp usr
- name: clean up
file: path={{ item }} state=absent
with_items:
- ruby-{{ version }}