Skip to content

Commit e266edf

Browse files
committed
initial commit
0 parents  commit e266edf

13 files changed

+554
-0
lines changed

README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
sa-rubu
2+
=========
3+
4+
* chruby
5+
* ruby-install
6+
* nginx + passenger
7+
* sample application
8+
9+
Requirements
10+
------------
11+
12+
Ubuntu 14.04 LTS
13+
14+
Role Variables
15+
--------------
16+
17+
rubies_location: /opt/rubies
18+
chruby_version: 0.3.9
19+
ruby_install_version: 0.6.0
20+
ruby_install_setsystem: true
21+
ruby_version: 2.3.0
22+
23+
24+
25+
app_short_name: app
26+
app_env: production
27+
app_repository: https://github.com/RailsApps/rails-devise.git
28+
app_base_dir: /var/www
29+
app_www_root: "{{app_base_dir}}/public"
30+
31+
app_directories:
32+
- "{{app_base_dir}}"
33+
34+
35+
36+
37+
Example Playbook
38+
----------------
39+
40+
41+
License
42+
-------
43+
44+
MIT
45+
46+
Author Information
47+
------------------
48+
49+
http://www.softasap.com/

defaults/main.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
# defaults file for sa-ruby
3+
4+
role_dir: "{{ lookup('pipe','pwd')|dirname }}"
5+
6+
needed_packages:
7+
- 'build-essential'
8+
- 'libssl-dev'
9+
- 'libyaml-dev'
10+
- 'libcurl4-openssl-dev'
11+
- 'htop'
12+
13+
rubies_location: /opt/rubies
14+
chruby_version: 0.3.9
15+
ruby_install_version: 0.6.0
16+
ruby_install_setsystem: true
17+
ruby_version: 2.3.0
18+
19+
20+
21+
app_short_name: app
22+
app_env: production
23+
app_repository: https://github.com/RailsApps/rails-devise.git
24+
app_base_dir: /var/www
25+
app_www_root: "{{app_base_dir}}/public"
26+
27+
app_directories:
28+
- "{{app_base_dir}}"

handlers/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# handlers file for sa-ruby

meta/main.yml

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
---
2+
galaxy_info:
3+
author: vyacheslav voronenko
4+
description:
5+
company: your company (optional)
6+
# If the issue tracker for your role is not on github, uncomment the
7+
# next line and provide a value
8+
# issue_tracker_url: http://example.com/issue/tracker
9+
# Some suggested licenses:
10+
# - BSD (default)
11+
# - MIT
12+
# - GPLv2
13+
# - GPLv3
14+
# - Apache
15+
# - CC-BY
16+
license: license (GPLv2, CC-BY, etc)
17+
min_ansible_version: 1.2
18+
#
19+
# Below are all platforms currently available. Just uncomment
20+
# the ones that apply to your role. If you don't see your
21+
# platform on this list, let us know and we'll get it added!
22+
#
23+
#platforms:
24+
#- name: EL
25+
# versions:
26+
# - all
27+
# - 5
28+
# - 6
29+
# - 7
30+
#- name: GenericUNIX
31+
# versions:
32+
# - all
33+
# - any
34+
#- name: Solaris
35+
# versions:
36+
# - all
37+
# - 10
38+
# - 11.0
39+
# - 11.1
40+
# - 11.2
41+
# - 11.3
42+
#- name: Fedora
43+
# versions:
44+
# - all
45+
# - 16
46+
# - 17
47+
# - 18
48+
# - 19
49+
# - 20
50+
# - 21
51+
# - 22
52+
# - 23
53+
#- name: opensuse
54+
# versions:
55+
# - all
56+
# - 12.1
57+
# - 12.2
58+
# - 12.3
59+
# - 13.1
60+
# - 13.2
61+
#- name: IOS
62+
# versions:
63+
# - all
64+
# - any
65+
#- name: SmartOS
66+
# versions:
67+
# - all
68+
# - any
69+
#- name: eos
70+
# versions:
71+
# - all
72+
# - Any
73+
#- name: Windows
74+
# versions:
75+
# - all
76+
# - 2012R2
77+
#- name: Amazon
78+
# versions:
79+
# - all
80+
# - 2013.03
81+
# - 2013.09
82+
#- name: GenericBSD
83+
# versions:
84+
# - all
85+
# - any
86+
#- name: Junos
87+
# versions:
88+
# - all
89+
# - any
90+
#- name: FreeBSD
91+
# versions:
92+
# - all
93+
# - 10.0
94+
# - 10.1
95+
# - 10.2
96+
# - 8.0
97+
# - 8.1
98+
# - 8.2
99+
# - 8.3
100+
# - 8.4
101+
# - 9.0
102+
# - 9.1
103+
# - 9.1
104+
# - 9.2
105+
# - 9.3
106+
#- name: Ubuntu
107+
# versions:
108+
# - all
109+
# - lucid
110+
# - maverick
111+
# - natty
112+
# - oneiric
113+
# - precise
114+
# - quantal
115+
# - raring
116+
# - saucy
117+
# - trusty
118+
# - utopic
119+
# - vivid
120+
# - wily
121+
#- name: SLES
122+
# versions:
123+
# - all
124+
# - 10SP3
125+
# - 10SP4
126+
# - 11
127+
# - 11SP1
128+
# - 11SP2
129+
# - 11SP3
130+
#- name: GenericLinux
131+
# versions:
132+
# - all
133+
# - any
134+
#- name: NXOS
135+
# versions:
136+
# - all
137+
# - any
138+
#- name: Debian
139+
# versions:
140+
# - all
141+
# - etch
142+
# - jessie
143+
# - lenny
144+
# - squeeze
145+
# - wheezy
146+
#
147+
# Below are all categories currently available. Just as with
148+
# the platforms above, uncomment those that apply to your role.
149+
#
150+
#categories:
151+
#- cloud
152+
#- cloud:ec2
153+
#- cloud:gce
154+
#- cloud:rax
155+
#- clustering
156+
#- database
157+
#- database:nosql
158+
#- database:sql
159+
#- development
160+
#- monitoring
161+
#- networking
162+
#- packaging
163+
#- system
164+
#- web
165+
dependencies: []
166+
# List your role dependencies here, one per line.
167+
# Be sure to remove the '[]' above if you add dependencies
168+
# to this list.

tasks/ch_ruby.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
- name: Ruby | Check if chruby is present
3+
shell: test -x /usr/local/bin/chruby-exec
4+
when: ansible_system == "Linux"
5+
ignore_errors: yes
6+
register: chruby_present
7+
tags: ruby
8+
9+
- name: Ruby | Download chruby distribution
10+
get_url: url="http://github.com/postmodern/chruby/archive/v{{ chruby_version }}.tar.gz"
11+
dest="/tmp/chruby-{{ chruby_version }}.tar.gz"
12+
when: chruby_present|failed
13+
tags: ruby
14+
15+
- name: Ruby | unpack chruby
16+
command: tar xf "/tmp/chruby-{{ chruby_version }}.tar.gz"
17+
chdir="/tmp"
18+
when: chruby_present|failed
19+
tags: ruby
20+
21+
- name: Ruby | chruby install target
22+
command: make install
23+
chdir="/tmp/chruby-{{ chruby_version }}"
24+
become: yes
25+
when: chruby_present|failed
26+
tags: ruby
27+
28+
- name: Ruby | autoload script
29+
template: src="{{role_dir}}/templates/ch_ruby.sh.j2" dest=/etc/profile.d/chruby.sh
30+
become: yes
31+
tags: ruby

tasks/main.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
# tasks file for sa-ruby
3+
- debug: msg="Tasks section"
4+
5+
- name: Playbook | package dependencies + cache update
6+
apt: pkg={{ item }} state=present force="yes" update_cache="yes"
7+
with_items: "{{needed_packages}}"
8+
become: yes
9+
10+
- include: 'ch_ruby.yml'
11+
12+
- include: 'ruby_install.yml'
13+
14+
- include: 'ruby.yml'
15+
16+
- include: 'nginx_passenger.yml'
17+
18+
- include: 'ruby_app_stub.yml'

0 commit comments

Comments
 (0)