forked from id/pepyatka-ansible
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ivan Dyachkov
committed
Mar 21, 2015
1 parent
a304ae5
commit 8199fb6
Showing
7 changed files
with
437 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,2 @@ | ||
[defaults] | ||
roles_path = roles |
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 @@ | ||
[target] | ||
188.166.9.62 ansible_ssh_user=root | ||
|
||
[redis:children] | ||
target |
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 @@ | ||
--- | ||
- hosts: all | ||
serial: 1 | ||
roles: | ||
- 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,31 @@ | ||
--- | ||
|
||
redis_bind_address: "0.0.0.0" | ||
redis_port: 6379 | ||
redis_syslog_enabled: "yes" | ||
# Must be USER or between LOCAL0-LOCAL7. | ||
redis_syslog_facility: "local0" | ||
redis_logfile: /var/log/redis.log | ||
redis_databases: 3 | ||
redis_database_save_times: | ||
- [900, 1] | ||
- [300, 10] | ||
- [60, 10000] | ||
redis_dbfilename: dump.rdb | ||
redis_db_dir: /var/lib/redis | ||
redis_role: master | ||
redis_requirepass: false | ||
redis_pass: None | ||
redis_max_clients: 128 | ||
redis_max_memory: 512mb | ||
redis_maxmemory_policy: volatile-lru | ||
redis_appendfsync: everysec | ||
# check https://www.kernel.org/doc/Documentation/sysctl/vm.txt | ||
# and http://redis.io/topics/faq | ||
redis_overcommit_memory: 1 | ||
#If role is slave set these values too | ||
redis_master_ip: 1.1.1.1 | ||
redis_master_port: 6379 | ||
redis_master_auth: None | ||
|
||
|
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: restart redis | ||
service: name=redis state=restarted |
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,29 @@ | ||
--- | ||
|
||
- name: Install epel-release | ||
yum: name=epel-release state=present | ||
|
||
- name: Install packages | ||
yum: name={{ item }} state=present | ||
with_items: | ||
- libselinux-python | ||
- redis | ||
|
||
- name: Deploy redis configuration file | ||
template: src=redis.conf.j2 dest=/etc/redis.conf | ||
notify: | ||
- restart redis | ||
|
||
- name: Set vm.overcommit_memory=1 | ||
sysctl: name=vm.overcommit_memory value=1 state=present | ||
|
||
- name: Ensure redis service is started and enabled | ||
service: name=redis state=started enabled=yes | ||
|
||
- name: Ensure redis is up and running | ||
command: redis-cli ping | ||
register: redis_response | ||
|
||
- name: assert redis is up | ||
fail: msg='redis is not happy' | ||
when: redis_response.stdout != "PONG" |
Oops, something went wrong.