Skip to content

Add option to install from repo instead of from source #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
## Installation options
redis_version: 2.8.24
redis_install_dir: /opt/redis
redis_install_from_source: true
redis_dir: /var/lib/redis/{{ redis_port }}
redis_config_file_name: "{{ redis_port }}.conf"
redis_download_url: "http://download.redis.io/releases/redis-{{ redis_version }}.tar.gz"
Expand Down
8 changes: 8 additions & 0 deletions tasks/install_from_repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- name: Install redis from repo
package:
name: redis

- name: Install redis-sentinel from repo
package:
name: redis-sentinel
when: redis_sentinel
10 changes: 9 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
- include: check_vars.yml

- include: download.yml
when: redis_install_from_source
tags:
- download

- include: dependencies.yml
when: redis_install_from_source
tags:
- install

- include: install.yml
- include: install_from_source.yml
when: redis_install_from_source
tags:
- install

- include: install_from_repo.yml
when: not redis_install_from_source
tags:
- install

Expand Down
5 changes: 3 additions & 2 deletions tasks/sentinel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- default/redis_sentinel.init.j2
paths:
- ../templates
when: redis_as_service and ansible_service_mgr|default() != "systemd"
when: redis_as_service and ansible_service_mgr|default() != "systemd" and not (not redis_install_from_source and redis_service_name == 'redis')

- name: create sentinel systemd service
template:
Expand All @@ -33,7 +33,7 @@
paths:
- ../templates
register: sentinel_unit_file
when: redis_as_service and ansible_service_mgr|default() == "systemd"
when: redis_as_service and ansible_service_mgr|default() == "systemd" and not (not redis_install_from_source and redis_service_name == 'redis')

- name: create systemd tmpfiles configuration
template:
Expand All @@ -44,6 +44,7 @@
- redis_as_service
- ansible_service_mgr|default() == "systemd"
- (redis_sentinel_pidfile|dirname).startswith("/var/run") or (redis_sentinel_pidfile|dirname).startswith("/run")
- not (not redis_install_from_source and redis_service_name == 'redis')

- name: reload systemd daemon
systemd:
Expand Down
5 changes: 3 additions & 2 deletions tasks/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- default/redis.init.j2
paths:
- ../templates
when: redis_as_service and ansible_service_mgr|default() != "systemd"
when: redis_as_service and ansible_service_mgr|default() != "systemd" and not (not redis_install_from_source and redis_service_name == 'redis')

- name: create redis systemd service
template:
Expand All @@ -33,7 +33,7 @@
paths:
- ../templates
register: redis_unit_file
when: redis_as_service and ansible_service_mgr|default() == "systemd"
when: redis_as_service and ansible_service_mgr|default() == "systemd" and not (not redis_install_from_source and redis_service_name == 'redis')

- name: create systemd tmpfiles configuration
template:
Expand All @@ -44,6 +44,7 @@
- redis_as_service
- ansible_service_mgr|default() == 'systemd'
- (redis_pidfile|dirname).startswith('/var/run') or (redis_pidfile|dirname).startswith('/run')
- not (not redis_install_from_source and redis_service_name == 'redis')

- name: reload systemd daemon
systemd:
Expand Down