diff --git a/README.md b/README.md index 142ba84..d28ccb4 100644 --- a/README.md +++ b/README.md @@ -105,13 +105,13 @@ redis_includes: [] 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. +The redis package name for installation via the system package manager. Defaults to `redis-server` on Debian and `redis` on RHEL/OpenSUSE. ```yaml redis_package_name: "redis-server" ``` -(Default for RHEL shown) The redis package name for installation via the system package manager. Defaults to `redis-server` on Debian and `redis` on RHEL. +(Default for RHEL shown) The redis package name for installation via the system package manager. Defaults to `redis-server` on Debian and `redis` on RHEL/OpenSUSE. ```yaml redis_requirepass: "" diff --git a/meta/main.yml b/meta/main.yml index d143c88..dd4aaf4 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -12,6 +12,9 @@ galaxy_info: - name: Fedora versions: - all + - name: opensuse + versions: + - 15.4 - name: Debian versions: - all diff --git a/tasks/main.yml b/tasks/main.yml index 03ee836..bb6604c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -31,5 +31,8 @@ - include_tasks: setup-Archlinux.yml when: ansible_os_family == 'Archlinux' +- include_tasks: setup-Suse.yml + when: ansible_os_family == 'Suse' + - name: Ensure Redis is running and enabled on boot. service: "name={{ redis_daemon }} state=started enabled=yes" diff --git a/tasks/setup-Suse.yml b/tasks/setup-Suse.yml new file mode 100644 index 0000000..2190640 --- /dev/null +++ b/tasks/setup-Suse.yml @@ -0,0 +1,15 @@ +--- +- name: Ensure Redis is installed. + package: + name: "{{ redis_package }}" + state: present + +- name: Ensure Redis configuration has the rights as advertised by the SuSE configuration. + ansible.builtin.file: + path: "{{ redis_conf_path }}" + mode: "{{ redis_conf_mode }}" + owner: root + group: redis + +- name: execute installation of data folder as recommended by SuSE + ansible.builtin.command: "install -d -o redis -g redis -m 0750 /var/lib/redis/{{ redis_instancename }}/" diff --git a/templates/redis.conf.j2 b/templates/redis.conf.j2 index 6c7e496..6d61ebc 100644 --- a/templates/redis.conf.j2 +++ b/templates/redis.conf.j2 @@ -1,7 +1,7 @@ # {{ ansible_managed }} daemonize yes -pidfile /var/run/redis/{{ redis_daemon }}.pid +pidfile {{ redis_pidfile }} port {{ redis_port }} bind {{ redis_bind_interface }} diff --git a/vars/Archlinux.yml b/vars/Archlinux.yml index 4aba213..6c793f7 100644 --- a/vars/Archlinux.yml +++ b/vars/Archlinux.yml @@ -1,4 +1,5 @@ --- __redis_package: redis redis_daemon: redis +redis_pidfile: /var/run/redis/{{ redis_daemon }}.pid redis_conf_path: /etc/redis.conf diff --git a/vars/Debian.yml b/vars/Debian.yml index f1a05c1..6aec905 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,6 +1,7 @@ --- __redis_package: redis-server redis_daemon: redis-server +redis_pidfile: /var/run/redis/{{ redis_daemon }}.pid redis_conf_dir_mode: 02770 redis_conf_path: /etc/redis/redis.conf redis_conf_mode: 0640 diff --git a/vars/RedHat.yml b/vars/RedHat.yml index f400573..832ef5b 100644 --- a/vars/RedHat.yml +++ b/vars/RedHat.yml @@ -1,6 +1,8 @@ --- __redis_package: redis redis_daemon: redis +redis_daemonize: "yes" +redis_pidfile: /var/run/redis/{{ redis_daemon }}.pid redis_conf_dir_mode: 0750 redis_conf_path: /etc/redis/redis.conf redis_conf_mode: 0644 diff --git a/vars/Suse.yml b/vars/Suse.yml new file mode 100644 index 0000000..b31677e --- /dev/null +++ b/vars/Suse.yml @@ -0,0 +1,8 @@ +--- +__redis_package: redis +redis_instancename: default +redis_daemon: "redis@{{ redis_instancename }}" +redis_pidfile: "/var/run/redis/{{ redis_instancename }}.pid" +# redis_suse_logfile: "/var/log/redis/{{ redis_instancename }}.log" +redis_conf_path: "/etc/redis/{{ redis_instancename }}.conf" +redis_conf_mode: 0640