Use redis role for peertube

This commit is contained in:
Ivan R. 2024-10-21 23:02:30 +05:00
parent 5b550885bd
commit afd3a73a2e
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
4 changed files with 53 additions and 78 deletions

View file

@ -1 +0,0 @@
save 60 1000

View file

@ -1,3 +1,54 @@
--- ---
- import_tasks: redis.yml - name: Create peertube network
- import_tasks: peertube.yml become: true
community.docker.docker_network:
name: peertube
- name: Create redis container
include_role:
name: redis
vars:
preset: persistent
container_name: peertube-redis
docker_networks:
- name: peertube
docker_volume: peertube-redis
- name: Create peertube config dir
become: true
ansible.builtin.file:
path: /etc/peertube
state: directory
mode: '1700'
owner: root
group: root
- name: Copy default config
become: true
ansible.builtin.copy:
src: default.yaml
dest: /etc/peertube/default.yaml
- name: Copy production config
become: true
ansible.builtin.template:
src: production.yaml.j2
dest: /etc/peertube/production.yaml
register: cfg
- name: Create peertube-data volume
become: true
community.docker.docker_volume:
name: peertube-data
- name: Run peertube container
become: true
community.docker.docker_container:
name: peertube
image: chocobozzz/peertube:v6.3.2-bookworm
networks:
- name: peertube
- name: haproxy
- name: postgresql
volumes:
- /mnt/hdd/peertube:/data
- /etc/peertube:/config
mounts:
- type: tmpfs
target: /data/tmp
tmpfs_size: "4G"
recreate: "{{ cfg.changed }}"

View file

@ -1,41 +0,0 @@
---
- name: Create peertube config dir
become: true
ansible.builtin.file:
path: /etc/peertube
state: directory
mode: '1700'
owner: root
group: root
- name: Copy default config
become: true
ansible.builtin.copy:
src: default.yaml
dest: /etc/peertube/default.yaml
- name: Copy production config
become: true
ansible.builtin.template:
src: production.yaml.j2
dest: /etc/peertube/production.yaml
register: cfg
- name: Create peertube-data volume
become: true
community.docker.docker_volume:
name: peertube-data
- name: Run peertube container
become: true
community.docker.docker_container:
name: peertube
image: chocobozzz/peertube:v6.3.2-bookworm
networks:
- name: peertube
- name: haproxy
- name: postgresql
volumes:
- /mnt/hdd/peertube:/data
- /etc/peertube:/config
mounts:
- type: tmpfs
target: /data/tmp
tmpfs_size: "4G"
recreate: "{{ cfg.changed }}"

View file

@ -1,34 +0,0 @@
---
- name: Create peertube network
become: true
community.docker.docker_network:
name: peertube
- name: Create peertube-redis docker volume
become: true
community.docker.docker_volume:
name: peertube-redis
- name: Create /etc/redis/peertube dir
become: true
ansible.builtin.file:
path: /etc/redis/peertube
state: directory
mode: '1755'
owner: root
group: root
- name: Copy redis config
become: true
ansible.builtin.copy:
src: redis.conf
dest: /etc/redis/peertube/redis.conf
- name: Run peertube-redis container
become: true
community.docker.docker_container:
name: peertube-redis
image: redis:7.4-bookworm
command: ["redis-server", "/etc/redis/redis.conf"]
networks:
- name: peertube
volumes:
- peertube-redis:/data
- /etc/redis/peertube:/etc/redis:ro
restart_policy: unless-stopped