Skip to content

Commit

Permalink
Merge pull request geerlingguy#10 from leventyalcin/master
Browse files Browse the repository at this point in the history
dynamic redis package name
  • Loading branch information
geerlingguy authored Sep 16, 2016
2 parents a3ad7d4 + 1ec8413 commit 5ce0c62
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ Snapshotting configuration; setting values in this list will save the database t
Database compression and location configuration.

redis_maxmemory: 0

Limit memory usage to the specified amount of bytes. Leave at 0 for unlimited.

redis_maxmemory_policy: "noeviction"

The method to use to keep memory usage below the limit, if specified. See [Using Redis as an LRU cache](http://redis.io/topics/lru-cache).

redis_maxmemory_samples: 5
Expand All @@ -73,6 +73,10 @@ Valid values are `always` (slower, safest), `everysec` (happy medium), or `no` (

Add extra include file paths to this list to include more/localized Redis configuration.

The redis package name for installation via the system package manager. Defaults to `redis-server` on Debian and `redis` on RHEL.

redis_package_name: "redis28u"

## Dependencies

None.
Expand Down
10 changes: 10 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"

- name: Define redis package name
set_fact:
redis_package_name: "{{ _redis_package_name }}"
when: redis_package_name is not defined

- name: Define redis repository name if the OS is RedHat
set_fact:
redis_package_enablerepo: "{{ _redis_package_enablerepo }}"
when: redis_package_enablerepo is not defined and ansible_os_family == 'RedHat'

# Setup/install tasks.
- include: setup-RedHat.yml
when: ansible_os_family == 'RedHat'
Expand Down
2 changes: 1 addition & 1 deletion tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
- name: Ensure redis is installed.
apt: name=redis-server state=installed
apt: name={{ redis_package_name }} state=installed
2 changes: 1 addition & 1 deletion tasks/setup-RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
- name: Ensure redis is installed.
yum: name=redis state=installed enablerepo=epel
yum: name={{ redis_package_name }} state=installed enablerepo={{ redis_package_enablerepo }}
1 change: 1 addition & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
redis_daemon: redis-server
redis_conf_path: /etc/redis/redis.conf
_redis_package_name: redis-server
2 changes: 2 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
redis_daemon: redis
redis_conf_path: /etc/redis.conf
_redis_package_name: redis
_redis_package_enablerepo: epel

0 comments on commit 5ce0c62

Please sign in to comment.