Skip to content

Commit

Permalink
add ruby 1.9.3 example
Browse files Browse the repository at this point in the history
  • Loading branch information
denglei committed Sep 4, 2014
1 parent 825a2e7 commit 550c3f0
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 0 deletions.
1 change: 1 addition & 0 deletions ruby_install_1.9.3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
本文介绍使用ansible的playbook功能在centos或者redhat 6系列系统里安装1.9.3版本ruby.
2 changes: 2 additions & 0 deletions ruby_install_1.9.3/roles/common/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: restart ntpd
service: name=ntpd state=restarted
16 changes: 16 additions & 0 deletions ruby_install_1.9.3/roles/common/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
galaxy_info:
author: Deng Lei
description: Install initializtion Software
license: MIT
min_ansible_version: 1.6
platforms:
- name: CentOS
versions:
- 5
- 6
- name: Ubuntu
versions:
- precise
categories:
- system
dependencies: []
3 changes: 3 additions & 0 deletions ruby_install_1.9.3/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- name: Install initializtion require software
shell: yum -y install make cmake bc gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced tar wget readline-devel libyaml-devel patch telnet dmidecode
poll: 0
12 changes: 12 additions & 0 deletions ruby_install_1.9.3/roles/ruby_delete/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
galaxy_info:
author: Deng Lei
description: Delete Ruby
license: MIT
min_ansible_version: 1.6
platforms:
- name: CentOS
versions:
- 6
categories:
- Service
dependencies: []
14 changes: 14 additions & 0 deletions ruby_install_1.9.3/roles/ruby_delete/tasks/delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- name: Stop Ruby Service In RedHat Client
shell: ps -ef|grep ruby|grep -v grep|awk '{print $2}'|xargs kill -9 >>/dev/null
ignore_errors: yes
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
- name: Delete Ruby Install Dir In RedHat Client
shell: rm -rf {{ ruby_dir}}/ruby-{{ ruby_version }}
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
- name: Delete Ruby Soft Link Script
shell: rm -rf /usr/bin/{{ item }}
with_items:
- ruby
- gem
- bundle
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
1 change: 1 addition & 0 deletions ruby_install_1.9.3/roles/ruby_delete/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- include: delete.yml
4 changes: 4 additions & 0 deletions ruby_install_1.9.3/roles/ruby_delete/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ruby_version: 1.9.3
ruby_dir: /usr/local
gem_version: 1.8.23
bundle_version: 1.6.3
Binary file not shown.
12 changes: 12 additions & 0 deletions ruby_install_1.9.3/roles/ruby_install/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
galaxy_info:
author: Deng Lei
description: Install Ruby
license: MIT
min_ansible_version: 1.6
platforms:
- name: CentOS
versions:
- 6
categories:
- Service
dependencies: []
13 changes: 13 additions & 0 deletions ruby_install_1.9.3/roles/ruby_install/tasks/copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: Copy Ruby Software To Redhat Client
copy: src=ruby-{{ ruby_version }}.tar.gz dest=/tmp/ruby-{{ ruby_version }}.tar.gz owner=root group=root
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
- name: Uncompression Ruby Software To Redhat Client
shell: tar zxf /tmp/ruby-{{ ruby_version }}.tar.gz -C {{ ruby_dir }}
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
- name: Copy Redis Config To Redhat Client
shell: ln -s {{ ruby_dir }}/ruby-{{ ruby_version }}/bin/{{ item }} /usr/bin/{{ item }}
with_items:
- ruby
- gem
- bundle
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
3 changes: 3 additions & 0 deletions ruby_install_1.9.3/roles/ruby_install/tasks/delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- name: Delete Ruby compression Software In Redhat Client
shell: rm -rf /tmp/ruby-{{ ruby_version }}.tar.gz
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6
2 changes: 2 additions & 0 deletions ruby_install_1.9.3/roles/ruby_install/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- include: copy.yml
- include: delete.yml
4 changes: 4 additions & 0 deletions ruby_install_1.9.3/roles/ruby_install/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ruby_version: 1.9.3
ruby_dir: /usr/local
gem_version: 1.8.23
bundle_version: 1.6.3
6 changes: 6 additions & 0 deletions ruby_install_1.9.3/ruby_delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: "{{host}}"
remote_user: "{{user}}"
gather_facts: True
roles:
- ruby_delete
7 changes: 7 additions & 0 deletions ruby_install_1.9.3/ruby_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: "{{host}}"
remote_user: "{{user}}"
gather_facts: True
roles:
- common
- ruby_install

0 comments on commit 550c3f0

Please sign in to comment.