Move Redis into its own role

This commit is contained in:
Salt 2020-04-26 01:22:36 -05:00
parent 58f31c403e
commit 824a17ad4d
8 changed files with 50 additions and 31 deletions

View File

@ -3,3 +3,7 @@ allow_duplicates: no
dependencies: dependencies:
- role: apache-php - role: apache-php
- role: mysql - role: mysql
- role: redis
- role: postfix-null
vars:
postfix_domain: {{ gitlab_url }}

View File

@ -52,37 +52,6 @@
- runit - runit
- yarn - yarn
- zlib1g-dev - zlib1g-dev
- name: Install and configure Redis
block:
- name: Install packages
apt:
name: "redis-server"
register: repo2
- name: Disable service
service:
name: redis-server
state: stopped
when: repo2 is changed
- name: Copy config
copy:
src: redis.conf
dest: "/etc/redis/redis.conf"
- name: Copy tmpfiles config
copy:
src: redis-tmpfile.conf
dest: "/etc/tmpfiles.d/redis.conf"
- name: Create socket directory
file:
path: "/var/run/redis"
state: directory
mode: 755
owner: redis
group: redis
- name: Enable and start service
service:
name: redis-server
state: started
enabled: yes
- name: Add gitlab user - name: Add gitlab user
user: user:
name: git name: git

View File

@ -0,0 +1,8 @@
#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: restart redis
service:
name: redis-server
state: restarted
become: yes

View File

@ -0,0 +1,2 @@
---
allow_duplicates: no

View File

@ -0,0 +1,31 @@
#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: Set up Redis
block:
- name: Install Redis
apt:
name: "redis-server"
register: apt-results
- name: Copy configs
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop:
- { src: "redis.conf", dest: "/etc/redis/redis.conf" }
- { src: "redis-tmpfiles.conf", dest: "/etc/tmpfiles.d/redis.conf" }
notify: restart redis
- name: Create socket directory
file:
path: "/var/run/redis"
state: directory
mode: "0755"
owner: redis
group: redis
notify: restart redis
- name: Start service
service:
name: redis-server
state: started
enabled: yes
become: yes

View File

@ -0,0 +1,5 @@
myhostname = {{ postfix_hostname }}
myorigin = $mydomain
#relayhost = $mydomain
inet_interfaces = loopback-only
mydestination =