Move Redis into its own role
This commit is contained in:
parent
58f31c403e
commit
824a17ad4d
@ -3,3 +3,7 @@ allow_duplicates: no
|
||||
dependencies:
|
||||
- role: apache-php
|
||||
- role: mysql
|
||||
- role: redis
|
||||
- role: postfix-null
|
||||
vars:
|
||||
postfix_domain: {{ gitlab_url }}
|
||||
|
@ -52,37 +52,6 @@
|
||||
- runit
|
||||
- yarn
|
||||
- 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
|
||||
user:
|
||||
name: git
|
||||
|
8
roles/redis/handlers/main.yml
Normal file
8
roles/redis/handlers/main.yml
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/ansible-playbook
|
||||
# vim:ft=ansible:
|
||||
---
|
||||
- name: restart redis
|
||||
service:
|
||||
name: redis-server
|
||||
state: restarted
|
||||
become: yes
|
2
roles/redis/meta/main.yml
Normal file
2
roles/redis/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
allow_duplicates: no
|
31
roles/redis/tasks/main.yml
Normal file
31
roles/redis/tasks/main.yml
Normal 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
|
5
roles/redis/templates/main.cf
Normal file
5
roles/redis/templates/main.cf
Normal file
@ -0,0 +1,5 @@
|
||||
myhostname = {{ postfix_hostname }}
|
||||
myorigin = $mydomain
|
||||
#relayhost = $mydomain
|
||||
inet_interfaces = loopback-only
|
||||
mydestination =
|
Loading…
Reference in New Issue
Block a user