Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
merifri committed Apr 10, 2019
1 parent c7152f9 commit 4442a10
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: python
python: "2.7"

env:
- ANSIBLE_VERSION=2.5.9
- ANSIBLE_VERSION=2.6.5
- ANSIBLE_VERSION=2.7.10
- ANSIBLE_VERSION=latest

before_install:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/cimon-io/ansible-role-redis.svg?branch=master)](https://travis-ci.org/cimon-io/ansible-role-redis) [![Ansible Galaxy](https://img.shields.io/badge/galaxy-cimon--io.redis-blue.svg)](https://galaxy.ansible.com/cimon-io/redis)

- Ansible 2.4+
- Ansible 2.6+
- Compatible with most versions of Ubuntu/Debian and RHEL/CentOS 6.x

## Contents
Expand Down Expand Up @@ -187,7 +187,7 @@ Here is a list of all the default variables for this role, which are also availa
``` yml
---
## Installation options
redis_version: 2.8.9
redis_version: 5.0.0
redis_install_dir: /opt/redis
redis_dir: /var/lib/redis/{{ redis_port }}
redis_download_url: "http://download.redis.io/releases/redis-{{ redis_version }}.tar.gz"
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,5 @@ redis_yum_32bit_dependencies:
- "libgcc.i686"
- "glibc-devel.i686"
redis_zypper_dependencies: "{{ ['gcc', 'make'] }} + {{ ['gcc-32bit', 'libgcc_s1-32bit'] if redis_make_32bit|bool else [] }}"

remote_package_retries: 5
7 changes: 4 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ galaxy_info:
role_name: redis
author: David Wittman
description: Highly configurable role to install Redis and Redis Sentinel from source
min_ansible_version: 2.4.0
min_ansible_version: 2.6.0
license: MIT
platforms:
- name: Ubuntu
Expand All @@ -19,8 +19,9 @@ galaxy_info:
versions:
- 11
- 12
categories:
galaxy_tags:
- database
- database:nosql
- nosql
- redis

dependencies: []
2 changes: 1 addition & 1 deletion tasks/check_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: check for checksum
fail:
msg: >
There is no sha1 checksum defined for version {{ redis_version }} in
There is no checksum defined for version {{ redis_version }} in
vars/main.yml. Set redis_checksum manually or submit a PR to add this
version.
when:
Expand Down
15 changes: 15 additions & 0 deletions tasks/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
update_cache: yes
cache_valid_time: 86400
state: present
retries: "{{ remote_package_retries }}"
register: apt_result
until: apt_result is succeeded
when: ansible_os_family == "Debian"

- name: install redhat dependencies
yum:
name: "{{ redis_yum_dependencies }}"
state: present
retries: "{{ remote_package_retries }}"
register: yum_result
until: yum_result is succeeded
when: ansible_os_family == "RedHat"

# Conditionally install the i686 build of libgcc if we are building 32-bit
Expand All @@ -20,16 +26,25 @@
yum:
name: libgcc
state: latest
retries: "{{ remote_package_retries }}"
register: yum_result
until: yum_result is succeeded
when: ansible_os_family == "RedHat" and redis_make_32bit|bool

- name: install redhat 32-bit dependencies
yum:
name: "{{ redis_yum_32bit_dependencies }}"
state: latest
retries: "{{ remote_package_retries }}"
register: yum_result
until: yum_result is succeeded
when: ansible_os_family == "RedHat" and redis_make_32bit|bool

- name: install suse dependencies
zypper:
name: "{{ redis_zypper_dependencies }}"
state: present
retries: "{{ remote_package_retries }}"
register: zyp_result
until: zyp_result is succeeded
when: ansible_os_family == 'Suse'
13 changes: 3 additions & 10 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,10 @@
path: /etc/redis
state: directory

- name: check if redis user exists (ignore errors)
command: id {{ redis_user }}
ignore_errors: yes
changed_when: false
register: user_exists

- name: add redis group
group:
name: "{{ redis_group }}"
state: present
when: user_exists is failed

- name: add redis user
user:
Expand All @@ -49,7 +42,7 @@
home: "{{ redis_install_dir }}"
shell: /bin/false
system: yes
when: user_exists is failed
state: present

- name: create /var/run/redis
file:
Expand All @@ -61,7 +54,7 @@
command: make PREFIX={{ redis_install_dir }} install
args:
chdir: /usr/local/src/redis-{{ redis_version }}
when: redis_prev_installation.stat.exists == False or redis_upgrade.changed
when: ( not redis_prev_installation.stat.exists ) or ( redis_upgrade is changed )
notify: "restart redis"

- name: list redis binaries to add to alternatives
Expand All @@ -74,4 +67,4 @@
name: "{{ item }}"
path: "{{ redis_install_dir }}/bin/{{ item }}"
link: "/usr/bin/{{ item }}"
with_items: "{{ redis_binaries.stdout_lines }}"
loop: "{{ redis_binaries.stdout_lines }}"
26 changes: 19 additions & 7 deletions tasks/sentinel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
- (redis_sentinel_pidfile|dirname).startswith("/var/run") or (redis_sentinel_pidfile|dirname).startswith("/run")

- name: reload systemd daemon
command: systemctl daemon-reload
systemd:
daemon_reload: True
when:
- redis_as_service
- ansible_service_mgr|default() == "systemd"
Expand Down Expand Up @@ -76,10 +77,11 @@
- redis_sentinel_logfile != '""'
- not sentinel_logdir.stat.exists

- name: touch the sentinel log file
file:
state: touch
path: "{{ redis_sentinel_logfile }}"
- name: create the sentinel log file
copy:
content: ""
dest: "{{ redis_sentinel_logfile }}"
force: no
owner: "{{ redis_user }}"
group: "{{ redis_group }}"
when: redis_sentinel_logfile != '""'
Expand All @@ -101,14 +103,24 @@
- redis_sentinel_pidfile != '""'
- not sentinel_piddir.stat.exists

- name: create sentinel config file
- name: create sentinel reference config file
template:
src: redis_sentinel.conf.j2
dest: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf
dest: /etc/redis/sentinel_{{ redis_sentinel_port }}.refconf
owner: "{{ redis_user }}"
mode: 0640
register: sentinel_refconf
notify: "restart sentinel {{ redis_sentinel_port }}"

- name: enforce new sentinel config file
copy:
remote_src: yes
src: /etc/redis/sentinel_{{ redis_sentinel_port }}.refconf
dest: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf
owner: "{{ redis_user }}"
mode: 0640
when: sentinel_refconf is changed

- name: add sentinel init config file
template:
dest: /etc/sysconfig/sentinel_{{ redis_sentinel_port }}
Expand Down
26 changes: 19 additions & 7 deletions tasks/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
- (redis_pidfile|dirname).startswith('/var/run') or (redis_pidfile|dirname).startswith('/run')

- name: reload systemd daemon
command: systemctl daemon-reload
systemd:
daemon_reload: True
when:
- redis_as_service
- ansible_service_mgr|default() == "systemd"
Expand Down Expand Up @@ -76,10 +77,11 @@
- redis_logfile != '""'
- not logdir.stat.exists

- name: touch the log file
file:
state: touch
path: "{{ redis_logfile }}"
- name: create the log file
copy:
content: ""
dest: "{{ redis_logfile }}"
force: no
owner: "{{ redis_user }}"
group: "{{ redis_group }}"
when: redis_logfile != '""'
Expand All @@ -101,14 +103,24 @@
- redis_pidfile != '""'
- not piddir.stat.exists

- name: create redis config file
- name: create redis reference config file
template:
src: redis.conf.j2
dest: /etc/redis/{{ redis_port }}.conf
dest: /etc/redis/{{ redis_port }}.refconf
owner: "{{ redis_user }}"
mode: 0640
register: redis_refconf
notify: "restart redis {{ redis_port }}"

- name: enforce new redis config file
copy:
remote_src: yes
src: /etc/redis/{{ redis_port }}.refconf
dest: /etc/redis/{{ redis_port }}.conf
owner: "{{ redis_user }}"
mode: 0640
when: redis_refconf is changed

- name: add redis init config file
template:
dest: /etc/sysconfig/{{ redis_service_name }}
Expand Down
7 changes: 7 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@ redis_checksums:
5.0-rc6: 5e5ffc9184021178c1d89375c5132a2b872a9f77569e8c08ccbdf322acff7ace
5.0.0: 70c98b2d0640b2b73c9d8adb4df63bcb62bad34b788fe46d1634b6cf87dc99a4
5.0.1: 82a67c0eec97f9ad379384c30ec391b269e17a3e4596393c808f02db7595abcb
5.0.2: 937dde6164001c083e87316aa20dad2f8542af089dfcb1cbb64f9c8300cd00ed
4.0.12: 6447259d2eed426a949c9c13f8fdb2d91fb66d9dc915dd50db13b87f46d93162
5.0.3: e290b4ddf817b26254a74d5d564095b11f9cd20d8f165459efa53eb63cd93e02
4.0.13: 17d955227966dcd68590be6139e5fe7f2d19fc4fb7334248a904ea9cdd30c1d4
5.0.4: 3ce9ceff5a23f60913e1573f6dfcd4aa53b42d4a2789e28fa53ec2bd28c987dd
4.0.14: 1e1e18420a86cfb285933123b04a82e1ebda20bfb0a289472745a087587e93a7
3.2.13: 862979c9853fdb1d275d9eb9077f34621596fec1843e3e7f2e2f09ce09a387ba

0 comments on commit 4442a10

Please sign in to comment.