-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add redis master and slave install by version 2.6.17
- Loading branch information
denglei
committed
Mar 27, 2015
1 parent
0aa9b7e
commit 690402b
Showing
34 changed files
with
1,424 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
本文介绍使用ansible的playbook功能在centos或者redhat 6系列系统里安装2.6.17版本redis主从. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- hosts: "{{host}}" | ||
remote_user: "{{user}}" | ||
gather_facts: True | ||
# sudo: True | ||
roles: | ||
- redis_delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- hosts: "{{host}}" | ||
remote_user: "{{user}}" | ||
gather_facts: True | ||
# sudo: True | ||
roles: | ||
- common | ||
- redis_install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- hosts: "{{host}}" | ||
remote_user: "{{user}}" | ||
gather_facts: True | ||
roles: | ||
- redis_slave_delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- hosts: "{{host}}" | ||
remote_user: "{{user}}" | ||
gather_facts: True | ||
roles: | ||
- common | ||
- redis_slave_install |
2 changes: 2 additions & 0 deletions
2
redis_master_slave_install_2.6.17/roles/common/handlers/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
16
redis_master_slave_install_2.6.17/roles/common/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
3
redis_master_slave_install_2.6.17/roles/common/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 lrzsz sysstat screen parted rsync libselinux-python dmidecode ntpdate sar openssh-clients | ||
poll: 0 |
12 changes: 12 additions & 0 deletions
12
redis_master_slave_install_2.6.17/roles/redis_delete/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
galaxy_info: | ||
author: Deng Lei | ||
description: Delete Redis | ||
license: MIT | ||
min_ansible_version: 1.6 | ||
platforms: | ||
- name: CentOS | ||
versions: | ||
- 6 | ||
categories: | ||
- Service | ||
dependencies: [] |
15 changes: 15 additions & 0 deletions
15
redis_master_slave_install_2.6.17/roles/redis_delete/tasks/delete.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
- name: Stop Redis Service In Redhat Client | ||
shell: /usr/bin/redis-cli -h {{ ansible_default_ipv4.address }} -p {{ redis_port }} shutdown | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 | ||
- name: Delete Redis Soft Line In Redhat Client | ||
shell: rm -rf /usr/bin/{{ item }} | ||
with_items: | ||
- redis-cli | ||
- redis-server | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 | ||
- name: Delete Redis Dir In Redhat Client | ||
shell: rm -rf {{ redis_dir }}/redis-{{ redis_version }} | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 | ||
- name: Delete Boot Start In Redhat Client | ||
shell: sed -i '/{{ redis_port }}*/d' /etc/rc.local | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 |
1 change: 1 addition & 0 deletions
1
redis_master_slave_install_2.6.17/roles/redis_delete/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- include: delete.yml |
5 changes: 5 additions & 0 deletions
5
redis_master_slave_install_2.6.17/roles/redis_delete/templates/delete_redis.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
/usr/bin/redis-cli -h {{ ansible_default_ipv4.address }} -p {{ redis_port }} shutdown | ||
rm -rf /usr/bin/redis-server /usr/bin/redis-cli | ||
rm -rf {{ redis_dir }}/redis-{{ redis_version }} | ||
sed -i '/{{ redis_port }}*/d' /etc/rc.local |
5 changes: 5 additions & 0 deletions
5
redis_master_slave_install_2.6.17/roles/redis_delete/vars/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
redis_dir: /data | ||
redis_version: 2.6.17 | ||
redis_port: 6379 | ||
redis_conf_dir: /data/redis-2.6.17/conf | ||
redis_db_dir: /data/redis-2.6.17/db |
Binary file added
BIN
+10.7 MB
redis_master_slave_install_2.6.17/roles/redis_install/files/redis-2.6.17.tar.gz
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
redis_master_slave_install_2.6.17/roles/redis_install/meta/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
galaxy_info: | ||
author: Deng Lei | ||
description: Install Redis | ||
license: MIT | ||
min_ansible_version: 1.6 | ||
platforms: | ||
- name: CentOS | ||
versions: | ||
- 6 | ||
categories: | ||
- Service | ||
dependencies: [] |
11 changes: 11 additions & 0 deletions
11
redis_master_slave_install_2.6.17/roles/redis_install/tasks/copy.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- name: Copy Redis Software To Redhat Client | ||
copy: src=redis-{{ redis_version }}.tar.gz dest=/tmp/redis-{{ redis_version }}.tar.gz owner=root group=root | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 | ||
- name: Create Redis Install Dir | ||
file: dest={{ redis_dir }} state=directory | ||
- name: Uncompression Redis Software To Redhat Client | ||
shell: tar zxf /tmp/redis-{{ redis_version }}.tar.gz -C /data/ | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 | ||
- name: Copy Redis Config To Redhat Client | ||
template: src=redis.conf dest={{ redis_conf_dir }}/redis_{{ redis_port }}.conf owner=root group=root mode=0644 | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 |
3 changes: 3 additions & 0 deletions
3
redis_master_slave_install_2.6.17/roles/redis_install/tasks/delete.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- name: Delete Redis compression Software In Redhat Client | ||
shell: rm -rf /tmp/redis-{{ redis_version }}.tar.gz | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 |
17 changes: 17 additions & 0 deletions
17
redis_master_slave_install_2.6.17/roles/redis_install/tasks/install.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
- name: Create Soft Link In Redhat Client | ||
shell: ln -s {{ redis_dir }}/redis-{{ redis_version }}/redis-server/src/{{ item }} /usr/bin/{{ item }} | ||
with_items: | ||
- redis-cli | ||
- redis-server | ||
ignore_errors: True | ||
- name: Check Boot Start In Redhat Client | ||
shell: grep -c '/usr/bin/redis-server {{ redis_conf_dir }}/redis_{{ redis_port }}.conf' /etc/rc.local | ||
register: redis_boot | ||
ignore_errors: True | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 | ||
- name: Add Boot Start In Redhat Client | ||
shell: echo "/usr/bin/redis-server {{ redis_conf_dir }}/redis_{{ redis_port }}.conf" >>/etc/rc.local | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 and redis_boot|int ==0 | ||
- name: Start Redis Service In Redhat Client | ||
shell: /usr/bin/redis-server {{ redis_conf_dir }}/redis_{{ redis_port }}.conf | ||
when: ansible_os_family == "RedHat" and ansible_distribution_version|int >=6 |
3 changes: 3 additions & 0 deletions
3
redis_master_slave_install_2.6.17/roles/redis_install/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- include: copy.yml | ||
- include: install.yml | ||
- include: delete.yml |
Oops, something went wrong.