Skip to content

Commit

Permalink
upgrade/downgrade redis
Browse files Browse the repository at this point in the history
  • Loading branch information
merifri committed Dec 26, 2017
1 parent 0b5887b commit c923c24
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 4 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
service:
name: "{{ redis_service_name }}"
state: restarted
when: redis_as_service
listen: "restart redis"
when: redis_as_service and not redis_sentinel

- name: "restart sentinel {{ redis_sentinel_port }}"
service:
name: sentinel_{{ redis_sentinel_port }}
state: restarted
when: redis_as_service
listen: "restart redis"
when: redis_as_service and redis_sentinel
2 changes: 2 additions & 0 deletions tasks/download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
url: "{{ redis_download_url }}"
dest: /usr/local/src/redis-{{ redis_version }}.tar.gz
sha256sum: "{{ redis_checksum|default(omit) }}"
register: redis_upgrade
when:
- not redis_tarball
- ansible_version.major < 2
Expand All @@ -25,6 +26,7 @@
url: "{{ redis_download_url }}"
dest: /usr/local/src/redis-{{ redis_version }}.tar.gz
checksum: "{{ redis_checksum|default(omit) }}"
register: redis_upgrade
when:
- not redis_tarball
- ansible_version.major >= 2
Expand Down
8 changes: 7 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
- name: check for redis installation
stat:
path: "{{ redis_install_dir }}/bin/redis-server"
register: redis_prev_installation

- name: enable overcommit in sysctl
sysctl:
name: vm.overcommit_memory
Expand Down Expand Up @@ -56,7 +61,8 @@
command: make PREFIX={{ redis_install_dir }} install
args:
chdir: /usr/local/src/redis-{{ redis_version }}
creates: "{{ redis_install_dir }}/bin/redis-server"
when: redis_prev_installation.stat.exists == False or redis_upgrade.changed
notify: "restart redis"

- name: list redis binaries to add to alternatives
command: ls -1 {{ redis_install_dir }}/bin
Expand Down

0 comments on commit c923c24

Please sign in to comment.