mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-ansible-private.git
synced 2026-05-14 08:35:22 +00:00
Compare commits
162 Commits
kubernetes
...
e12c4a9943
| Author | SHA1 | Date | |
|---|---|---|---|
| e12c4a9943 | |||
| 643959ea2f | |||
| e200933337 | |||
| bdd082160f | |||
| 0f092ca010 | |||
| 0e06c98eb3 | |||
| e1a1de87ff | |||
| 7341189808 | |||
| 2e70ecf649 | |||
| 3b4ae9517e | |||
| 9ec50c9d68 | |||
| 82675ca850 | |||
| 9297ee3964 | |||
| 0a0e3982e8 | |||
| c0ac96265e | |||
| 71fe67c1e0 | |||
| 8a49477449 | |||
| 46505df323 | |||
| 0294601e2c | |||
| 1e827ede7b | |||
| d8e54b6af4 | |||
| 7f42b439c9 | |||
| 67dc792660 | |||
| 128823f456 | |||
| 9e703cf9fd | |||
| 8ccda6978e | |||
| f832f2ad37 | |||
| f7c345e505 | |||
| 5460418ecb | |||
| 696c542b6b | |||
| 0fda7f84ba | |||
| 82f9ab4ead | |||
| 51c4466103 | |||
| cb1bf070b0 | |||
| 8dec820f1d | |||
| 31f624c429 | |||
| 955d1ac2f2 | |||
| 4377f5917c | |||
| 4eb7726ed8 | |||
| 369b8dae80 | |||
| 1c24b3e030 | |||
| 607a6b82c3 | |||
| 3c4fab1534 | |||
| 4b1fa18f7f | |||
| 40b8d89ee7 | |||
| bdda2191c4 | |||
| 6c5290a118 | |||
| b857640bf6 | |||
| ff0f048859 | |||
| 78659b1c77 | |||
| 32ef4ccb0d | |||
| b509854496 | |||
| c51a7d81be | |||
| b053fc8019 | |||
| 0cb3784757 | |||
| 2115a8aa61 | |||
| 076cb81c9d | |||
| bdafea0784 | |||
| 3b5d59a589 | |||
| 3c07b1b998 | |||
| dbbcc45525 | |||
| d3981868cf | |||
| 6c78b7ce39 | |||
| ebd772665b | |||
| 21d91805ad | |||
| c00cd6a94f | |||
| a34e5a5e8b | |||
| 71ec9945b1 | |||
| 11dbff9b8a | |||
| fecbc54b79 | |||
| d693a947f2 | |||
| 8c882adffe | |||
| fff458af5a | |||
| de1925a486 | |||
| 2fdee619ca | |||
| 47411136d0 | |||
| 08a0bb3761 | |||
| 27b924b558 | |||
| d460624689 | |||
| 676cc04dd4 | |||
| e62baff9e7 | |||
| f532ff4507 | |||
| dd420b851c | |||
| 07698ad8a3 | |||
| b981b12635 | |||
| 5441e7852e | |||
| 5df04be859 | |||
| baa06e11d3 | |||
| 3afed3f5bd | |||
| 5d82af3236 | |||
| 946621ae59 | |||
| d6d5a94fd1 | |||
| d47040565a | |||
| a794dcd037 | |||
| fee0b08777 | |||
| d047d1da32 | |||
| 0d93657131 | |||
| 1b1d683d38 | |||
| 2bca89aa2d | |||
| e2450e477a | |||
| 4be17277b9 | |||
| f45445443f | |||
| 9e50c6c110 | |||
| 1e20c82f27 | |||
| adcbcca46c | |||
| 91355e6724 | |||
| 3d2d3278f3 | |||
| ab1769f830 | |||
| 91ded9edd2 | |||
| 460a1e07a3 | |||
| 5fab44c939 | |||
| 46994b5cc7 | |||
| 6dcc0640b6 | |||
| 20e6e518a4 | |||
| 99f42d7223 | |||
| d9d8a41574 | |||
| 2e3fe12b16 | |||
| bd480ae5cf | |||
| 564a9b028c | |||
| ae076fd98a | |||
| 5ce25f0267 | |||
| 5bb538322b | |||
| f34763271e | |||
| 1456906d65 | |||
| 87e269c4b0 | |||
| b172e24a0e | |||
| c850375dd4 | |||
| 9e7f5be196 | |||
| e64863f887 | |||
| c0a8b0b00a | |||
| 2b060b27f0 | |||
| 895dacd28d | |||
| d5ed666c77 | |||
| 6b864989f5 | |||
| b4b99298e7 | |||
| 077ac6f39b | |||
| 35a95c6553 | |||
| aa55c290e1 | |||
| e2c0cb640c | |||
| 6b0bbff17c | |||
| 7c2908bea6 | |||
| d79c611824 | |||
| b4ee6d1b83 | |||
| b774664389 | |||
| fd63bc9f0e | |||
| e8e9fa2d01 | |||
| 928c6b2445 | |||
| dc2f6b163c | |||
| 2f2d3c621b | |||
| e057170f9c | |||
| db1d69e566 | |||
| 138e0e5b8d | |||
| fe48f35c87 | |||
| e295c09152 | |||
| 814abb92dd | |||
| 983167e8bc | |||
| a142e3acda | |||
| 2eaea3dbb3 | |||
| db87c453ce | |||
| 5d60378c35 | |||
| 892b80c438 | |||
| 39dd5e0c72 |
@ -2,7 +2,7 @@ name: IACAnsible
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ kubernetes-vazio ]
|
branches: [ main ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -35,7 +35,7 @@ jobs:
|
|||||||
bw login --apikey
|
bw login --apikey
|
||||||
echo "session"
|
echo "session"
|
||||||
BW_SESSION=$(bw unlock "$BW_PASSWORD" --raw)
|
BW_SESSION=$(bw unlock "$BW_PASSWORD" --raw)
|
||||||
|
echo "BW_SESSION=$BW_SESSION" >> $GITEA_ENV
|
||||||
|
|
||||||
- name: Cloning ansible repository
|
- name: Cloning ansible repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -55,4 +55,6 @@ jobs:
|
|||||||
- name: Run Ansible Playbook
|
- name: Run Ansible Playbook
|
||||||
working-directory: ansible/iac
|
working-directory: ansible/iac
|
||||||
run: |
|
run: |
|
||||||
ansible-playbook -i inventory.ini playbook.yml
|
ansible-playbook -i inventory.ini playbook.yml -e "BW_CLIENTID=$BW_CLIENTID BW_CLIENTSECRET=$BW_CLIENTSECRET BW_PASSWORD=$BW_PASSWORD BW_EMAIL=$BW_EMAIL"
|
||||||
|
env:
|
||||||
|
BW_SESSION: ${{ env.BW_SESSION }}
|
||||||
15
README.md
15
README.md
@ -1,3 +1,18 @@
|
|||||||
# iac-ansible-private
|
# iac-ansible-private
|
||||||
|
|
||||||
iac-ansible-private
|
iac-ansible-private
|
||||||
|
|
||||||
|
stolon comes from https://github.com/sorintlab/stolon/blob/master/examples/kubernetes/README.md
|
||||||
|
qbittorrent comes from https://github.com/j4ym0/pia-qbittorrent-docker?tab=readme-ov-file
|
||||||
|
prowlarr comes from https://docs.linuxserver.io/images/docker-prowlarr/#docker-mods
|
||||||
|
and https://wiki.servarr.com/prowlarr/environment-variables
|
||||||
|
sonarr comes from https://wiki.servarr.com/sonarr/environment-variables
|
||||||
|
and https://docs.linuxserver.io/images/docker-sonarr/#supported-architectures
|
||||||
|
jellyfin comes from https://docs.linuxserver.io/images/docker-jellyfin/
|
||||||
|
flaresolverr comes from https://github.com/FlareSolverr/FlareSolverr
|
||||||
|
jellyseer comes from https://hub.docker.com/r/fallenbagel/jellyseerr
|
||||||
|
and https://docs.seerr.dev/extending-jellyseerr/database-config
|
||||||
|
decluttarr comes from https://github.com/ManiMatter/decluttarr
|
||||||
|
minecraft comes from https://www.civo.com/learn/deploying-minecraft-server-kubernetes
|
||||||
|
|
||||||
|

|
||||||
BIN
fenix-iac.png
Normal file
BIN
fenix-iac.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
36
playbook.yml
36
playbook.yml
@ -3,13 +3,49 @@
|
|||||||
become: yes
|
become: yes
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
|
- vaultwarden
|
||||||
- kubernetes
|
- kubernetes
|
||||||
- kube-master
|
- kube-master
|
||||||
|
- nvidia-base
|
||||||
|
|
||||||
- name: Configure Kubernetes Nodes
|
- name: Configure Kubernetes Nodes
|
||||||
hosts: workers
|
hosts: workers
|
||||||
become: yes
|
become: yes
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
|
- vaultwarden
|
||||||
- kubernetes
|
- kubernetes
|
||||||
- kube-node
|
- kube-node
|
||||||
|
- nvidia-base
|
||||||
|
|
||||||
|
- name: Configure Kubernetes Data
|
||||||
|
hosts: master
|
||||||
|
become: yes
|
||||||
|
roles:
|
||||||
|
- metrics
|
||||||
|
- nvidia
|
||||||
|
- stolon
|
||||||
|
- cloudflared
|
||||||
|
- qbittorrent
|
||||||
|
- prowlarr
|
||||||
|
- sonarr
|
||||||
|
- radarr
|
||||||
|
- jellyfin
|
||||||
|
- flaresolverr
|
||||||
|
- jellyseerr
|
||||||
|
- decluttarr
|
||||||
|
- bazarr
|
||||||
|
- libreTranslate
|
||||||
|
- lingarr
|
||||||
|
- cripto
|
||||||
|
- anchorr
|
||||||
|
- lazylibrarian
|
||||||
|
- mangareader
|
||||||
|
- bookshelf
|
||||||
|
- shelfarr
|
||||||
|
- minecraft
|
||||||
|
- lidarr
|
||||||
|
- soulseek
|
||||||
|
- soularr
|
||||||
|
- mariadb
|
||||||
|
- uptime-kuma
|
||||||
46
roles/anchorr/files/anchorr-deployment.yaml
Normal file
46
roles/anchorr/files/anchorr-deployment.yaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: anchorr
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: anchorr
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: anchorr
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: anchorr
|
||||||
|
image: nairdah/anchorr:latest
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
ports:
|
||||||
|
- containerPort: 8282
|
||||||
|
name: webhook
|
||||||
|
env:
|
||||||
|
- name: PUID
|
||||||
|
value: "1013"
|
||||||
|
- name: PGID
|
||||||
|
value: "1013"
|
||||||
|
- name: TZ
|
||||||
|
value: 'Etc/UTC'
|
||||||
|
- name: NODE_ENV
|
||||||
|
value: 'production'
|
||||||
|
- name: WEBHOOK_PORT
|
||||||
|
value: '8282'
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /usr/src/app/config
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: anchorr-config-pvc
|
||||||
|
|
||||||
11
roles/anchorr/files/anchorr-nfs-csi.yaml
Normal file
11
roles/anchorr/files/anchorr-nfs-csi.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: anchorr-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/anchorr
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
29
roles/anchorr/files/anchorr-pvcs.yaml
Normal file
29
roles/anchorr/files/anchorr-pvcs.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: anchorr-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 2Gi
|
||||||
|
storageClassName: anchorr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/anchorr/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: anchorr-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: anchorr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: anchorr-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
12
roles/anchorr/files/anchorr-service.yaml
Normal file
12
roles/anchorr/files/anchorr-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: anchorr-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 8282
|
||||||
|
targetPort: 8282
|
||||||
|
selector:
|
||||||
|
app: anchorr
|
||||||
|
type: ClusterIP
|
||||||
51
roles/anchorr/tasks/main.yml
Normal file
51
roles/anchorr/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/anchorr/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/anchorr/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/anchorr/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/anchorr/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Obter várias notas do Bitwarden
|
||||||
|
# shell: |
|
||||||
|
# echo "unlock"
|
||||||
|
# BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
# echo "get item"
|
||||||
|
# bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
# loop:
|
||||||
|
# - { id: "iac.ansible.stackarr.anchorr.secret", dest: "/tmp/stack-arr/anchorr/kubernetes-files/files/anchorr-secret.yaml" }
|
||||||
|
# args:
|
||||||
|
# executable: /bin/bash
|
||||||
|
# environment:
|
||||||
|
# BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/anchorr/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/anchorr/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/anchorr/vars/main.yml
Normal file
4
roles/anchorr/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
79
roles/bazarr/files/bazarr-deployment.yaml
Normal file
79
roles/bazarr/files/bazarr-deployment.yaml
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: bazarr
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: bazarr
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: bazarr
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: bazarr
|
||||||
|
image: lscr.io/linuxserver/bazarr:1.5.6
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
ports:
|
||||||
|
- containerPort: 6767
|
||||||
|
name: webui
|
||||||
|
env:
|
||||||
|
- name: BAZARR_DEBUG
|
||||||
|
value: "true"
|
||||||
|
- name: PUID
|
||||||
|
value: "1013"
|
||||||
|
- name: PGID
|
||||||
|
value: "1013"
|
||||||
|
- name: TZ
|
||||||
|
value: 'Etc/UTC'
|
||||||
|
- name: POSTGRES_ENABLED
|
||||||
|
value: 'true'
|
||||||
|
- name: POSTGRES_HOST
|
||||||
|
value: 'stolon-proxy-service.postgresql.svc.cluster.local'
|
||||||
|
- name: POSTGRES_PORT
|
||||||
|
value: '5432'
|
||||||
|
- name: POSTGRES_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: bazarr-secret
|
||||||
|
key: username
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: bazarr-secret
|
||||||
|
key: password
|
||||||
|
- name: POSTGRES_DATABASE
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: bazarr-secret
|
||||||
|
key: maindb
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /config
|
||||||
|
- name: media
|
||||||
|
mountPath: /media
|
||||||
|
- name: lingarrpy
|
||||||
|
mountPath: /app/bazarr/bin/bazarr/subtitles/tools/translate/services/lingarr_translator.py
|
||||||
|
subPath: lingarr_translator.py
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: bazarr-config-pvc
|
||||||
|
- name: media
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: bazarr-media-pvc
|
||||||
|
- name: lingarrpy
|
||||||
|
configMap:
|
||||||
|
name: bazarr-lingarrpy-configmap
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
roles/bazarr/files/bazarr-nfs-csi.yaml
Normal file
11
roles/bazarr/files/bazarr-nfs-csi.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: bazarr-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/bazarr
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
60
roles/bazarr/files/bazarr-pvcs.yaml
Normal file
60
roles/bazarr/files/bazarr-pvcs.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: bazarr-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 2Gi
|
||||||
|
storageClassName: bazarr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/bazarr/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: bazarr-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: bazarr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: bazarr-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: bazarr-media-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 150Gi
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: bazarr-media-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: bazarr-media-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 150Gi
|
||||||
|
---
|
||||||
11
roles/bazarr/files/bazarr-secret.yaml
Normal file
11
roles/bazarr/files/bazarr-secret.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: bazarr-secret
|
||||||
|
namespace: stack-arr
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
username: dXNlcm5hbWU=
|
||||||
|
password: cGFzc3dvcmQ=
|
||||||
|
maindb: bWFpbmRiLXByb3dsYXJy
|
||||||
|
logsdb: bG9nZGItcHJvd2xhcnI=
|
||||||
12
roles/bazarr/files/bazarr-service.yaml
Normal file
12
roles/bazarr/files/bazarr-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: bazarr-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 6767
|
||||||
|
targetPort: 6767
|
||||||
|
selector:
|
||||||
|
app: bazarr
|
||||||
|
type: ClusterIP
|
||||||
207
roles/bazarr/files/lingarr-configmap.yaml
Normal file
207
roles/bazarr/files/lingarr-configmap.yaml
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: bazarr-lingarrpy-configmap
|
||||||
|
namespace: stack-arr
|
||||||
|
data:
|
||||||
|
lingarr_translator.py: |
|
||||||
|
# coding=utf-8
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import pysubs2
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from retry.api import retry
|
||||||
|
from deep_translator.exceptions import TooManyRequests, RequestError
|
||||||
|
|
||||||
|
from app.config import settings
|
||||||
|
from app.database import TableShows, TableEpisodes, TableMovies, database, select
|
||||||
|
from app.jobs_queue import jobs_queue
|
||||||
|
from languages.custom_lang import CustomLanguage
|
||||||
|
from languages.get_languages import alpha3_from_alpha2, language_from_alpha2, language_from_alpha3
|
||||||
|
from radarr.history import history_log_movie
|
||||||
|
from sonarr.history import history_log
|
||||||
|
from subtitles.processing import ProcessSubtitlesResult
|
||||||
|
from utilities.path_mappings import path_mappings
|
||||||
|
|
||||||
|
from ..core.translator_utils import add_translator_info, create_process_result, get_title
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class LingarrTranslatorService:
|
||||||
|
def __init__(self, source_srt_file, dest_srt_file, lang_obj, to_lang, from_lang, media_type,
|
||||||
|
video_path, orig_to_lang, forced, hi, sonarr_series_id, sonarr_episode_id,
|
||||||
|
radarr_id):
|
||||||
|
self.source_srt_file = source_srt_file
|
||||||
|
self.dest_srt_file = dest_srt_file
|
||||||
|
self.lang_obj = lang_obj
|
||||||
|
self.to_lang = to_lang
|
||||||
|
self.from_lang = from_lang
|
||||||
|
self.media_type = media_type
|
||||||
|
self.video_path = video_path
|
||||||
|
self.orig_to_lang = orig_to_lang
|
||||||
|
self.forced = forced
|
||||||
|
self.hi = hi
|
||||||
|
self.sonarr_series_id = sonarr_series_id
|
||||||
|
self.sonarr_episode_id = sonarr_episode_id
|
||||||
|
self.radarr_id = radarr_id
|
||||||
|
self.language_code_convert_dict = {
|
||||||
|
'zh': 'zh-CN',
|
||||||
|
'zt': 'zh-TW',
|
||||||
|
'pb': 'pt-BR',
|
||||||
|
}
|
||||||
|
|
||||||
|
def translate(self, job_id=None):
|
||||||
|
try:
|
||||||
|
jobs_queue.update_job_progress(job_id=job_id, progress_max=1, progress_message=self.source_srt_file)
|
||||||
|
|
||||||
|
subs = pysubs2.load(self.source_srt_file, encoding='utf-8')
|
||||||
|
lines_list = [x.plaintext for x in subs]
|
||||||
|
lines_list_len = len(lines_list)
|
||||||
|
|
||||||
|
if lines_list_len == 0:
|
||||||
|
logger.debug('No lines to translate in subtitle file')
|
||||||
|
return self.dest_srt_file
|
||||||
|
|
||||||
|
logger.debug(f'Starting translation for {self.source_srt_file}')
|
||||||
|
translated_lines = self._translate_content(lines_list, job_id=job_id)
|
||||||
|
|
||||||
|
if translated_lines is None:
|
||||||
|
logger.error(f'Translation failed for {self.source_srt_file}')
|
||||||
|
jobs_queue.update_job_progress(job_id=job_id,
|
||||||
|
progress_message=f'Translation failed for {self.source_srt_file}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
logger.debug(f'BAZARR saving Lingarr translated subtitles to {self.dest_srt_file}')
|
||||||
|
translation_map = {}
|
||||||
|
for item in translated_lines:
|
||||||
|
if isinstance(item, dict) and 'position' in item and 'line' in item:
|
||||||
|
translation_map[item['position']] = item['line']
|
||||||
|
|
||||||
|
for i, line in enumerate(subs):
|
||||||
|
if i in translation_map and translation_map[i]:
|
||||||
|
line.text = translation_map[i]
|
||||||
|
|
||||||
|
try:
|
||||||
|
subs.save(self.dest_srt_file)
|
||||||
|
add_translator_info(self.dest_srt_file, f"# Subtitles translated with Lingarr # ")
|
||||||
|
except OSError:
|
||||||
|
logger.error(f'BAZARR is unable to save translated subtitles to {self.dest_srt_file}')
|
||||||
|
jobs_queue.update_job_progress(job_id=job_id,
|
||||||
|
progress_message=f'Translation failed: Unable to save translated '
|
||||||
|
f'subtitles to {self.dest_srt_file}')
|
||||||
|
raise OSError
|
||||||
|
|
||||||
|
message = (f"{language_from_alpha2(self.from_lang)} subtitles translated to "
|
||||||
|
f"{language_from_alpha3(self.to_lang)} using Lingarr.")
|
||||||
|
result = create_process_result(message, self.video_path, self.orig_to_lang, self.forced, self.hi,
|
||||||
|
self.dest_srt_file, self.media_type)
|
||||||
|
|
||||||
|
if self.media_type == 'series':
|
||||||
|
history_log(action=6,
|
||||||
|
sonarr_series_id=self.sonarr_series_id,
|
||||||
|
sonarr_episode_id=self.sonarr_episode_id,
|
||||||
|
result=result)
|
||||||
|
else:
|
||||||
|
history_log_movie(action=6,
|
||||||
|
radarr_id=self.radarr_id,
|
||||||
|
result=result)
|
||||||
|
|
||||||
|
jobs_queue.update_job_progress(job_id=job_id, progress_value='max')
|
||||||
|
|
||||||
|
return self.dest_srt_file
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f'BAZARR encountered an error during Lingarr translation: {str(e)}')
|
||||||
|
jobs_queue.update_job_progress(job_id=job_id, progress_message=f'Lingarr translation failed: {str(e)}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
@retry(exceptions=(TooManyRequests, RequestError, requests.exceptions.RequestException), tries=3, delay=1,
|
||||||
|
backoff=2, jitter=(0, 1))
|
||||||
|
def _translate_content(self, lines_list, job_id):
|
||||||
|
try:
|
||||||
|
source_lang = self.language_code_convert_dict.get(self.from_lang, self.from_lang)
|
||||||
|
target_lang = self.language_code_convert_dict.get(self.orig_to_lang, self.orig_to_lang)
|
||||||
|
|
||||||
|
lines_payload = []
|
||||||
|
for i, line in enumerate(lines_list):
|
||||||
|
lines_payload.append({
|
||||||
|
"position": i,
|
||||||
|
"line": line if line and line.strip() else 'a'
|
||||||
|
})
|
||||||
|
|
||||||
|
title = get_title(
|
||||||
|
media_type=self.media_type,
|
||||||
|
radarr_id=self.radarr_id,
|
||||||
|
sonarr_series_id=self.sonarr_series_id,
|
||||||
|
sonarr_episode_id=self.sonarr_episode_id
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.media_type == 'series':
|
||||||
|
api_media_type = "Episode"
|
||||||
|
arr_media_id = self.sonarr_series_id or 0
|
||||||
|
else:
|
||||||
|
api_media_type = "Movie"
|
||||||
|
arr_media_id = self.radarr_id or 0
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"arrMediaId": arr_media_id,
|
||||||
|
"title": title,
|
||||||
|
"sourceLanguage": source_lang,
|
||||||
|
"targetLanguage": target_lang,
|
||||||
|
"mediaType": api_media_type,
|
||||||
|
"lines": lines_payload
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug(f'BAZARR is sending {len(lines_payload)} lines to Lingarr with full media context')
|
||||||
|
|
||||||
|
headers = {"Content-Type": "application/json"}
|
||||||
|
if settings.translator.lingarr_token:
|
||||||
|
headers["X-Api-Key"] = settings.translator.lingarr_token
|
||||||
|
|
||||||
|
response = requests.post(
|
||||||
|
f"{settings.translator.lingarr_url}/api/translate/content",
|
||||||
|
json=payload,
|
||||||
|
headers=headers,
|
||||||
|
timeout=1800
|
||||||
|
)
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
translated_batch = response.json()
|
||||||
|
# Validate response
|
||||||
|
if isinstance(translated_batch, list):
|
||||||
|
for item in translated_batch:
|
||||||
|
if not isinstance(item, dict) or 'position' not in item or 'line' not in item:
|
||||||
|
logger.error(f'Invalid response format from Lingarr API: {item}')
|
||||||
|
return None
|
||||||
|
return translated_batch
|
||||||
|
else:
|
||||||
|
logger.error(f'Unexpected response format from Lingarr API: {translated_batch}')
|
||||||
|
return None
|
||||||
|
elif response.status_code == 401:
|
||||||
|
raise RequestError("Authentication failed: Invalid or missing API key")
|
||||||
|
elif response.status_code == 429:
|
||||||
|
raise TooManyRequests("Rate limit exceeded")
|
||||||
|
elif response.status_code >= 500:
|
||||||
|
raise RequestError(f"Server error: {response.status_code}")
|
||||||
|
else:
|
||||||
|
logger.debug(f'Lingarr API error: {response.status_code} - {response.text}')
|
||||||
|
return None
|
||||||
|
|
||||||
|
except requests.exceptions.Timeout:
|
||||||
|
logger.debug('Lingarr API request timed out')
|
||||||
|
raise RequestError("Request timed out")
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
logger.debug('Lingarr API connection error')
|
||||||
|
raise RequestError("Connection error")
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
logger.debug(f'Lingarr API request failed: {str(e)}')
|
||||||
|
raise
|
||||||
|
except (TooManyRequests, RequestError) as e:
|
||||||
|
logger.error(f'Lingarr API error after retries: {str(e)}')
|
||||||
|
jobs_queue.update_job_progress(job_id=job_id, progress_message=f'Lingarr API error: {str(e)}')
|
||||||
|
raise
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f'Unexpected error in Lingarr translation: {str(e)}')
|
||||||
|
jobs_queue.update_job_progress(job_id=job_id, progress_message=f'Translation error: {str(e)}')
|
||||||
BIN
roles/bazarr/files/teste.yml
Normal file
BIN
roles/bazarr/files/teste.yml
Normal file
Binary file not shown.
51
roles/bazarr/tasks/main.yml
Normal file
51
roles/bazarr/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/bazarr/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/bazarr/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/bazarr/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/bazarr/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Obter várias notas do Bitwarden
|
||||||
|
shell: |
|
||||||
|
echo "unlock"
|
||||||
|
BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
echo "get item"
|
||||||
|
bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
loop:
|
||||||
|
- { id: "iac.ansible.stackarr.bazarr.secret", dest: "/tmp/stack-arr/bazarr/kubernetes-files/files/bazarr-secret.yaml" }
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
environment:
|
||||||
|
BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/bazarr/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/bazarr/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/bazarr/vars/main.yml
Normal file
4
roles/bazarr/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
54
roles/bookshelf/files/bookshelf-deployment.yaml
Normal file
54
roles/bookshelf/files/bookshelf-deployment.yaml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: bookshelf
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: bookshelf
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: bookshelf
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: bookshelf
|
||||||
|
image: ghcr.io/pennydreadful/bookshelf:softcover-v0.4.20.91
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
ports:
|
||||||
|
- containerPort: 8787
|
||||||
|
name: webui
|
||||||
|
env:
|
||||||
|
- name: PUID
|
||||||
|
value: "1013"
|
||||||
|
- name: PGID
|
||||||
|
value: "1013"
|
||||||
|
- name: TZ
|
||||||
|
value: 'Etc/UTC'
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /config
|
||||||
|
- name: books
|
||||||
|
mountPath: /books
|
||||||
|
- name: downloads
|
||||||
|
mountPath: /downloads
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: bookshelf-config-pvc
|
||||||
|
- name: books
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: bookshelf-books-pvc
|
||||||
|
- name: downloads
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: qbittorrent-downloads-pvc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
roles/bookshelf/files/bookshelf-nfs-csi.yaml
Normal file
11
roles/bookshelf/files/bookshelf-nfs-csi.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: bookshelf-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/bookshelf
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
60
roles/bookshelf/files/bookshelf-pvcs.yaml
Normal file
60
roles/bookshelf/files/bookshelf-pvcs.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: bookshelf-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 20Gi
|
||||||
|
storageClassName: bookshelf-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/bookshelf/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: bookshelf-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: bookshelf-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: bookshelf-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 20Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: bookshelf-media-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 150Gi
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series/Livros
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: bookshelf-books-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: bookshelf-media-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 150Gi
|
||||||
|
---
|
||||||
12
roles/bookshelf/files/bookshelf-service.yaml
Normal file
12
roles/bookshelf/files/bookshelf-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: bookshelf-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 8787
|
||||||
|
targetPort: 8787
|
||||||
|
selector:
|
||||||
|
app: bookshelf
|
||||||
|
type: ClusterIP
|
||||||
51
roles/bookshelf/tasks/main.yml
Normal file
51
roles/bookshelf/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/bookshelf/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/bookshelf/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/bookshelf/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/bookshelf/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Obter várias notas do Bitwarden
|
||||||
|
# shell: |
|
||||||
|
# echo "unlock"
|
||||||
|
# BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
# echo "get item"
|
||||||
|
# bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
# loop:
|
||||||
|
# - { id: "iac.ansible.stackarr.bookshelf.secret", dest: "/tmp/stack-arr/bookshelf/kubernetes-files/files/bookshelf-secret.yaml" }
|
||||||
|
# args:
|
||||||
|
# executable: /bin/bash
|
||||||
|
# environment:
|
||||||
|
# BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/bookshelf/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/bookshelf/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/bookshelf/vars/main.yml
Normal file
4
roles/bookshelf/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
4
roles/cloudflared/files/cloudflare-namespace.yaml
Normal file
4
roles/cloudflared/files/cloudflare-namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: cloudflare
|
||||||
49
roles/cloudflared/files/cloudflared-tunnel-deployment.yaml
Normal file
49
roles/cloudflared/files/cloudflared-tunnel-deployment.yaml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: cloudflared-tunnel
|
||||||
|
namespace: cloudflare
|
||||||
|
spec:
|
||||||
|
replicas: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: cloudflared
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: cloudflared
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
sysctls:
|
||||||
|
# Allows ICMP traffic (ping, traceroute) to resources behind cloudflared.
|
||||||
|
- name: net.ipv4.ping_group_range
|
||||||
|
value: "65532 65532"
|
||||||
|
containers:
|
||||||
|
- image: cloudflare/cloudflared:latest
|
||||||
|
name: cloudflared
|
||||||
|
env:
|
||||||
|
# Defines an environment variable for the tunnel token.
|
||||||
|
- name: TUNNEL_TOKEN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: tunnel-token-secret
|
||||||
|
key: token
|
||||||
|
command:
|
||||||
|
# Configures tunnel run parameters
|
||||||
|
- cloudflared
|
||||||
|
- tunnel
|
||||||
|
- --no-autoupdate
|
||||||
|
- --loglevel
|
||||||
|
- debug
|
||||||
|
- --metrics
|
||||||
|
- 0.0.0.0:2000
|
||||||
|
- run
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
# Cloudflared has a /ready endpoint which returns 200 if and only if
|
||||||
|
# it has an active connection to Cloudflare's network.
|
||||||
|
path: /ready
|
||||||
|
port: 2000
|
||||||
|
failureThreshold: 1
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
periodSeconds: 10
|
||||||
8
roles/cloudflared/files/tunnel-token-secret.yaml
Normal file
8
roles/cloudflared/files/tunnel-token-secret.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: tunnel-token-secret
|
||||||
|
namespace: cloudflare
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
token: <CLOUDFLARE_TUNNEL_TOKEN>
|
||||||
51
roles/cloudflared/tasks/main.yml
Normal file
51
roles/cloudflared/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/cloudflare/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/cloudflare/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/cloudflare/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/cloudflare/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Obter várias notas do Bitwarden
|
||||||
|
shell: |
|
||||||
|
echo "unlock"
|
||||||
|
BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
echo "get item"
|
||||||
|
bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
loop:
|
||||||
|
- { id: "iac.ansible.cloudflare.tunnel.secret", dest: "/tmp/cloudflare/kubernetes-files/files/tunnel-token-secret.yaml" }
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
environment:
|
||||||
|
BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/cloudflare/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/cloudflare/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/cloudflared/vars/main.yml
Normal file
4
roles/cloudflared/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
94
roles/cripto/files/ai-deployment.yaml
Normal file
94
roles/cripto/files/ai-deployment.yaml
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: fenix-ai
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: crypto-forecast-api-deployment
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
replicas: 0
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: crypto-forecast-api
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: crypto-forecast-api
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: crypto-forecast-api
|
||||||
|
image: gitea.fenix-dev.com/fenix-gitea-admin/fenix-cripto-api:0.0.19
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
nvidia.com/gpu: 1 # garante uso da tua RTX 4060 Ti
|
||||||
|
env:
|
||||||
|
- name: ASPNETCORE_ENVIRONMENT
|
||||||
|
value: Development
|
||||||
|
volumeMounts:
|
||||||
|
- name: model
|
||||||
|
mountPath: /models
|
||||||
|
volumes:
|
||||||
|
- name: model
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: crypto-forecast-api-model-pvc
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: crypto-forecast-api-svc
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: crypto-forecast-api
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 8080
|
||||||
|
targetPort: 8080
|
||||||
|
type: NodePort # ou LoadBalancer se tiveres suporte
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: crypto-forecast-api-model-pv
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 20Gi
|
||||||
|
storageClassName: fenix-ai-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/fenix/ai/api/model
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: crypto-forecast-api-model-pvc
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
storageClassName: fenix-ai-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: crypto-forecast-api-model-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 20Gi
|
||||||
|
---
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: fenix-ai-nfs-csi
|
||||||
|
namespace: fenix-ai
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
4
roles/cripto/files/ai-namespace.yaml
Normal file
4
roles/cripto/files/ai-namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: fenix-ai
|
||||||
191
roles/cripto/files/ai-ollama-deployment.yaml
Normal file
191
roles/cripto/files/ai-ollama-deployment.yaml
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
apiVersion: metallb.io/v1beta1
|
||||||
|
kind: IPAddressPool
|
||||||
|
metadata:
|
||||||
|
name: local-pool-2
|
||||||
|
namespace: metallb-system
|
||||||
|
spec:
|
||||||
|
addresses:
|
||||||
|
- 192.168.1.100-192.168.1.200
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: ai-openwebui-deployment
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: ai-openwebui
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: ai-openwebui
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: ai-openwebui
|
||||||
|
image: ghcr.io/open-webui/open-webui:cuda
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
env:
|
||||||
|
- name: WEBUI_HOST
|
||||||
|
value: "0.0.0.0"
|
||||||
|
- name: OLLAMA_BASE_URL
|
||||||
|
value: "http://ollama-api-svc.fenix-ai.svc.cluster.local:11434"
|
||||||
|
volumeMounts:
|
||||||
|
- name: ai-openwebui-data
|
||||||
|
mountPath: /app/backend/data
|
||||||
|
volumes:
|
||||||
|
- name: ai-openwebui-data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: ai-openwebui-data-pvc
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: ai-openwebui-data-pv
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 40Gi
|
||||||
|
storageClassName: ai-openwebui-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/ai-openwebui
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: ai-openwebui-data-pvc
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
storageClassName: ai-openwebui-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 40Gi
|
||||||
|
---
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: ai-openwebui-nfs-csi
|
||||||
|
namespace: fenix-ai
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/ai-openwebui
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: ai-openwebui-svc
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: ai-openwebui
|
||||||
|
ports:
|
||||||
|
- port: 8080
|
||||||
|
targetPort: 8080
|
||||||
|
type: ClusterIP # ou LoadBalancer se tiveres suporte
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: ollama-deployment
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: ollama
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: ollama
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: ollama
|
||||||
|
image: ollama/ollama:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 11434
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
nvidia.com/gpu: 1 # garante uso da tua RTX 4060 Ti
|
||||||
|
memory: 17Gi
|
||||||
|
env:
|
||||||
|
- name: OLLAMA_HOST
|
||||||
|
value: "0.0.0.0"
|
||||||
|
- name: NVIDIA_VISIBLE_DEVICES
|
||||||
|
value: "all"
|
||||||
|
- name: NVIDIA_DRIVER_CAPABILITIES
|
||||||
|
value: "compute,utility"
|
||||||
|
- name: CUDA_VISIBLE_DEVICES
|
||||||
|
value: "0"
|
||||||
|
volumeMounts:
|
||||||
|
- name: ollama-data
|
||||||
|
mountPath: /root/.ollama
|
||||||
|
volumes:
|
||||||
|
- name: ollama-data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: ollama-data-pvc
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: ollama-api-svc
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: ollama
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 11434
|
||||||
|
targetPort: 11434
|
||||||
|
type: NodePort # ou LoadBalancer se tiveres suporte
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: ollama-data-pv
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 40Gi
|
||||||
|
storageClassName: ollama-ai-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/ollama
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: ollama-data-pvc
|
||||||
|
namespace: fenix-ai
|
||||||
|
spec:
|
||||||
|
storageClassName: ollama-ai-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 40Gi
|
||||||
|
---
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: ollama-ai-nfs-csi
|
||||||
|
namespace: fenix-ai
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/ollama
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
51
roles/cripto/tasks/main.yml
Normal file
51
roles/cripto/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/fenix-ai/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/fenix-ai/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/fenix-ai/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/fenix-ai/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Obter várias notas do Bitwarden
|
||||||
|
# shell: |
|
||||||
|
# echo "unlock"
|
||||||
|
# BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
# echo "get item"
|
||||||
|
# bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
# loop:
|
||||||
|
# - { id: "iac.ansible.stackarr.decluttarr.secret", dest: "/tmp/stack-arr/decluttarr/kubernetes-files/files/decluttarr-secret.yaml" }
|
||||||
|
# args:
|
||||||
|
# executable: /bin/bash
|
||||||
|
# environment:
|
||||||
|
# BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/fenix-ai/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/fenix-ai/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/cripto/vars/main.yml
Normal file
4
roles/cripto/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
79
roles/decluttarr/files/decluttarr-deployment.yaml
Normal file
79
roles/decluttarr/files/decluttarr-deployment.yaml
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: decluttarr
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: decluttarr
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: decluttarr
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: decluttarr
|
||||||
|
image: ghcr.io/manimatter/decluttarr:v1.50.2
|
||||||
|
env:
|
||||||
|
- name: LOG_LEVEL
|
||||||
|
value: VERBOSE
|
||||||
|
- name: REMOVE_TIMER
|
||||||
|
value: '3'
|
||||||
|
- name: REMOVE_FAILED
|
||||||
|
value: 'True'
|
||||||
|
- name: REMOVE_FAILED_IMPORTS
|
||||||
|
value: 'False'
|
||||||
|
- name: REMOVE_METADATA_MISSING
|
||||||
|
value: 'True'
|
||||||
|
- name: REMOVE_MISSING_FILES
|
||||||
|
value: 'True'
|
||||||
|
- name: REMOVE_ORPHANS
|
||||||
|
value: 'True'
|
||||||
|
- name: REMOVE_SLOW
|
||||||
|
value: 'False'
|
||||||
|
- name: REMOVE_STALLED
|
||||||
|
value: 'True'
|
||||||
|
- name: REMOVE_UNMONITORED
|
||||||
|
value: 'False'
|
||||||
|
- name: MIN_DOWNLOAD_SPEED
|
||||||
|
value: '100'
|
||||||
|
- name: PERMITTED_ATTEMPTS
|
||||||
|
value: '3'
|
||||||
|
- name: SONARR_URL
|
||||||
|
value: http://sonarr-service.stack-arr.svc.cluster.local:8989
|
||||||
|
- name: SONARR_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: decluttarr-secret
|
||||||
|
key: sonarrkey
|
||||||
|
- name: QBITTORRENT_URL
|
||||||
|
value: http://qbittorrent-service.stack-arr.svc.cluster.local:8080
|
||||||
|
- name: QBITTORRENT_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: decluttarr-secret
|
||||||
|
key: qbittorrentuser
|
||||||
|
- name: QBITTORRENT_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: decluttarr-secret
|
||||||
|
key: qbittorrentpass
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /config
|
||||||
|
- name: downloads
|
||||||
|
mountPath: /data/downloads
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: decluttarr-config-pvc
|
||||||
|
- name: downloads
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: qbittorrent-downloads-pvc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
12
roles/decluttarr/files/decluttarr-nfs-csi.yaml
Normal file
12
roles/decluttarr/files/decluttarr-nfs-csi.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: decluttarr-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/decluttarr
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
|
---
|
||||||
30
roles/decluttarr/files/decluttarr-pvcs.yaml
Normal file
30
roles/decluttarr/files/decluttarr-pvcs.yaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: decluttarr-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 2Gi
|
||||||
|
storageClassName: decluttarr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/decluttarr/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: decluttarr-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: decluttarr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: decluttarr-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
10
roles/decluttarr/files/decluttarr-secret.yaml
Normal file
10
roles/decluttarr/files/decluttarr-secret.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: decluttarr-secret
|
||||||
|
namespace: stack-arr
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
sonarrkey: M2tkMDRscjk1bGY5M29lMDNsZTAzbGU=
|
||||||
|
qbittorrentuser: dXNlcg==
|
||||||
|
qbittorrentpass: cGFzcw==
|
||||||
51
roles/decluttarr/tasks/main.yml
Normal file
51
roles/decluttarr/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/decluttarr/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/decluttarr/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/decluttarr/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/decluttarr/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Obter várias notas do Bitwarden
|
||||||
|
shell: |
|
||||||
|
echo "unlock"
|
||||||
|
BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
echo "get item"
|
||||||
|
bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
loop:
|
||||||
|
- { id: "iac.ansible.stackarr.decluttarr.secret", dest: "/tmp/stack-arr/decluttarr/kubernetes-files/files/decluttarr-secret.yaml" }
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
environment:
|
||||||
|
BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/decluttarr/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/decluttarr/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/decluttarr/vars/main.yml
Normal file
4
roles/decluttarr/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
32
roles/flaresolverr/files/flaresolverr-deployment.yaml
Normal file
32
roles/flaresolverr/files/flaresolverr-deployment.yaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: flaresolverr
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: flaresolverr
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: flaresolverr
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: flaresolverr
|
||||||
|
image: ghcr.io/flaresolverr/flaresolverr:latest
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
ports:
|
||||||
|
- containerPort: 8191
|
||||||
|
name: porta
|
||||||
|
env:
|
||||||
|
- name: LOG_LEVEL
|
||||||
|
value: "info"
|
||||||
|
|
||||||
|
|
||||||
12
roles/flaresolverr/files/flaresolverr-service.yaml
Normal file
12
roles/flaresolverr/files/flaresolverr-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: flaresolverr-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 8191
|
||||||
|
targetPort: 8191
|
||||||
|
selector:
|
||||||
|
app: flaresolverr
|
||||||
|
type: ClusterIP
|
||||||
51
roles/flaresolverr/tasks/main.yml
Normal file
51
roles/flaresolverr/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/sonarr/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/sonarr/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/sonarr/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/sonarr/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Obter várias notas do Bitwarden
|
||||||
|
# shell: |
|
||||||
|
# echo "unlock"
|
||||||
|
# BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
# echo "get item"
|
||||||
|
# bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
# loop:
|
||||||
|
# - { id: "iac.ansible.stackarr.sonarr.secret", dest: "/tmp/stack-arr/sonarr/kubernetes-files/files/sonarr-secret.yaml" }
|
||||||
|
# args:
|
||||||
|
# executable: /bin/bash
|
||||||
|
# environment:
|
||||||
|
# BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/sonarr/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/sonarr/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/flaresolverr/vars/main.yml
Normal file
4
roles/flaresolverr/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
65
roles/jellyfin/files/jellyfin-deployment.yaml
Normal file
65
roles/jellyfin/files/jellyfin-deployment.yaml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: jellyfin
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: jellyfin
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: jellyfin
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: jellyfin
|
||||||
|
image: lscr.io/linuxserver/jellyfin:10.11.5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: "9G" # Maximum memory allowed
|
||||||
|
cpu: "4" # Maximum CPU allowed
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
ports:
|
||||||
|
- containerPort: 8096
|
||||||
|
name: webui
|
||||||
|
- containerPort: 8920
|
||||||
|
name: webuihttps
|
||||||
|
- containerPort: 1900
|
||||||
|
name: dlnaudp
|
||||||
|
- containerPort: 7359
|
||||||
|
name: discoveryudp
|
||||||
|
env:
|
||||||
|
- name: PUID
|
||||||
|
value: "1013"
|
||||||
|
- name: PGID
|
||||||
|
value: "1013"
|
||||||
|
- name: TZ
|
||||||
|
value: 'Etc/UTC'
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /config
|
||||||
|
- name: videos
|
||||||
|
mountPath: /videos
|
||||||
|
- name: books
|
||||||
|
mountPath: /books
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: jellyfin-config-pvc
|
||||||
|
- name: videos
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: jellyfin-videos-pvc
|
||||||
|
- name: books
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: jellyfin-books-pvc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
23
roles/jellyfin/files/jellyfin-nfs-csi.yaml
Normal file
23
roles/jellyfin/files/jellyfin-nfs-csi.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/jellyfin
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
|
---
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-videos-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
93
roles/jellyfin/files/jellyfin-pvcs.yaml
Normal file
93
roles/jellyfin/files/jellyfin-pvcs.yaml
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 2Gi
|
||||||
|
storageClassName: jellyfin-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/jellyfin/config
|
||||||
|
mountOptions:
|
||||||
|
- nolock
|
||||||
|
- nfsvers=3
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: jellyfin-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: jellyfin-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-videos-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 150Gi
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-videos-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: jellyfin-videos-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 150Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-books-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 150Gi
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series/Livros
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-books-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: jellyfin-books-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 150Gi
|
||||||
|
---
|
||||||
22
roles/jellyfin/files/jellyfin-service.yaml
Normal file
22
roles/jellyfin/files/jellyfin-service.yaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: jellyfin-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 8096
|
||||||
|
targetPort: 8096
|
||||||
|
name: webui
|
||||||
|
- port: 8920
|
||||||
|
targetPort: 8920
|
||||||
|
name: webuihttps
|
||||||
|
- port: 1900
|
||||||
|
targetPort: 1900
|
||||||
|
name: dlnaudp
|
||||||
|
- port: 7359
|
||||||
|
targetPort: 7359
|
||||||
|
name: discoveryudp
|
||||||
|
selector:
|
||||||
|
app: jellyfin
|
||||||
|
type: ClusterIP
|
||||||
51
roles/jellyfin/tasks/main.yml
Normal file
51
roles/jellyfin/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/jellyfin/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/jellyfin/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/jellyfin/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/jellyfin/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Obter várias notas do Bitwarden
|
||||||
|
# shell: |
|
||||||
|
# echo "unlock"
|
||||||
|
# BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
# echo "get item"
|
||||||
|
# bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
# loop:
|
||||||
|
# - { id: "iac.ansible.stackarr.jellyfin.secret", dest: "/tmp/stack-arr/jellyfin/kubernetes-files/files/jelly-secret.yaml" }
|
||||||
|
# args:
|
||||||
|
# executable: /bin/bash
|
||||||
|
# environment:
|
||||||
|
# BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/jellyfin/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/jellyfin/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/jellyfin/vars/main.yml
Normal file
4
roles/jellyfin/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
62
roles/jellyseerr/files/jellyseerr-deployment.yaml
Normal file
62
roles/jellyseerr/files/jellyseerr-deployment.yaml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: jellyseerr
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: jellyseerr
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: jellyseerr
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: jellyseerr
|
||||||
|
image: fallenbagel/jellyseerr:2.7.3
|
||||||
|
ports:
|
||||||
|
- containerPort: 5055
|
||||||
|
name: webui
|
||||||
|
env:
|
||||||
|
- name: TZ
|
||||||
|
value: 'Etc/UTC'
|
||||||
|
- name: LOG_LEVEL
|
||||||
|
value: 'debug'
|
||||||
|
- name: DB_TYPE
|
||||||
|
value: 'postgres'
|
||||||
|
- name: DB_HOST
|
||||||
|
value: 'stolon-proxy-service.postgresql.svc.cluster.local'
|
||||||
|
- name: DB_PORT
|
||||||
|
value: '5432'
|
||||||
|
- name: DB_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: jellyseerr-secret
|
||||||
|
key: username
|
||||||
|
- name: DB_PASS
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: jellyseerr-secret
|
||||||
|
key: password
|
||||||
|
- name: DB_NAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: jellyseerr-secret
|
||||||
|
key: maindb
|
||||||
|
- name: DB_LOG_QUERIES
|
||||||
|
value: 'false'
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /app/config
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: jellyseerr-config-pvc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
roles/jellyseerr/files/jellyseerr-nfs-csi.yaml
Normal file
11
roles/jellyseerr/files/jellyseerr-nfs-csi.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: jellyseerr-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/jellyseerr
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
30
roles/jellyseerr/files/jellyseerr-pvcs.yaml
Normal file
30
roles/jellyseerr/files/jellyseerr-pvcs.yaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: jellyseerr-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 2Gi
|
||||||
|
storageClassName: jellyseerr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/jellyseerr/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: jellyseerr-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: jellyseerr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: jellyseerr-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
10
roles/jellyseerr/files/jellyseerr-secret.yaml
Normal file
10
roles/jellyseerr/files/jellyseerr-secret.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: jellyseerr-secret
|
||||||
|
namespace: stack-arr
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
username: dXNlcm5hbWU=
|
||||||
|
password: cGFzc3dvcmQ=
|
||||||
|
maindb: bWFpbmRiLXByb3dsYXJy
|
||||||
12
roles/jellyseerr/files/jellyseerr-service.yaml
Normal file
12
roles/jellyseerr/files/jellyseerr-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: jellyseerr-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 5055
|
||||||
|
targetPort: 5055
|
||||||
|
selector:
|
||||||
|
app: jellyseerr
|
||||||
|
type: ClusterIP
|
||||||
51
roles/jellyseerr/tasks/main.yml
Normal file
51
roles/jellyseerr/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/jellyseerr/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/jellyseerr/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/jellyseerr/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/jellyseerr/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Obter várias notas do Bitwarden
|
||||||
|
shell: |
|
||||||
|
echo "unlock"
|
||||||
|
BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
echo "get item"
|
||||||
|
bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
loop:
|
||||||
|
- { id: "iac.ansible.stackarr.jellyseerr.secret", dest: "/tmp/stack-arr/jellyseerr/kubernetes-files/files/jellyseerr-secret.yaml" }
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
environment:
|
||||||
|
BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/jellyseerr/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/jellyseerr/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/jellyseerr/vars/main.yml
Normal file
4
roles/jellyseerr/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
@ -22,7 +22,7 @@
|
|||||||
replace:
|
replace:
|
||||||
path: /tmp/kube-flannel.yml
|
path: /tmp/kube-flannel.yml
|
||||||
regexp: '10\.244\.0\.0/16'
|
regexp: '10\.244\.0\.0/16'
|
||||||
replace: '10.244.0.0/16' # .3.
|
replace: '10.240.0.0/16' # .3.
|
||||||
|
|
||||||
- name: Corrigir net-conf.json no manifest do Flannel
|
- name: Corrigir net-conf.json no manifest do Flannel
|
||||||
become: true
|
become: true
|
||||||
@ -55,8 +55,9 @@
|
|||||||
argv:
|
argv:
|
||||||
- kubeadm
|
- kubeadm
|
||||||
- init
|
- init
|
||||||
- --pod-network-cidr=10.244.0.0/16 # .3.
|
- --pod-network-cidr=10.240.0.0/16 # .3.
|
||||||
- --apiserver-advertise-address=192.168.1.150
|
- --apiserver-advertise-address=192.168.1.50
|
||||||
|
- --service-cidr=10.95.0.0/16
|
||||||
creates: /etc/kubernetes/admin.conf
|
creates: /etc/kubernetes/admin.conf
|
||||||
|
|
||||||
|
|
||||||
@ -102,6 +103,37 @@
|
|||||||
delay: 6
|
delay: 6
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
|
|
||||||
|
- name: kubernetes untaint node-role.kubernetes.io/control-plane:NoSchedule
|
||||||
|
become: true
|
||||||
|
shell: |
|
||||||
|
kubectl taint nodes --all node-role.kubernetes.io/control-plane:NoSchedule-
|
||||||
|
become_user: fenix
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
|
||||||
|
- name: kubernetes unlabel node-role.kubernetes.io/control-plane
|
||||||
|
become: true
|
||||||
|
shell: |
|
||||||
|
kubectl label nodes --all node-role.kubernetes.io/control-plane-
|
||||||
|
become_user: fenix
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: kubernetes unlabel node.kubernetes.io/exclude-from-external-load-balancers
|
||||||
|
become: true
|
||||||
|
shell: |
|
||||||
|
kubectl label nodes --all node.kubernetes.io/exclude-from-external-load-balancers-
|
||||||
|
become_user: fenix
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: cat flannel
|
- name: cat flannel
|
||||||
become: true
|
become: true
|
||||||
shell: |
|
shell: |
|
||||||
@ -133,6 +165,81 @@
|
|||||||
delay: 6
|
delay: 6
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
|
- name: Instalar Helm no nó master
|
||||||
|
become: true
|
||||||
|
shell: |
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
||||||
|
args:
|
||||||
|
creates: /usr/local/bin/helm
|
||||||
|
|
||||||
|
- name: Adicionar repositório Helm do CSI NFS
|
||||||
|
command: >
|
||||||
|
helm repo add csi-driver-nfs https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts
|
||||||
|
args:
|
||||||
|
creates: /root/.cache/helm/repository/csi-driver-nfs-index.yaml
|
||||||
|
|
||||||
|
- name: Atualizar repositórios Helm
|
||||||
|
command: helm repo update
|
||||||
|
|
||||||
|
- name: Instalar CSI NFS Driver via Helm
|
||||||
|
command: helm upgrade --install csi-driver-nfs csi-driver-nfs/csi-driver-nfs --namespace kube-system --version 4.12.0
|
||||||
|
register: resultado_nfs
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do nfs csi driver
|
||||||
|
debug:
|
||||||
|
var: resultado_nfs.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Instalar MetalLB (manifest oficial)
|
||||||
|
shell: kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.9/config/manifests/metallb-native.yaml
|
||||||
|
become_user: fenix
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
|
||||||
|
- name: Esperar pelo webhook do MetalLB
|
||||||
|
shell: kubectl get endpoints webhook-service -n metallb-system -o jsonpath='{.subsets[*].addresses[*].ip}'
|
||||||
|
register: webhook_ready
|
||||||
|
until: webhook_ready.stdout != ""
|
||||||
|
retries: 10
|
||||||
|
delay: 10
|
||||||
|
become_user: fenix
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
|
||||||
|
- name: Criar IP pool
|
||||||
|
shell: |
|
||||||
|
cat <<EOF | kubectl apply -f -
|
||||||
|
apiVersion: metallb.io/v1beta1
|
||||||
|
kind: IPAddressPool
|
||||||
|
metadata:
|
||||||
|
name: local-pool
|
||||||
|
namespace: metallb-system
|
||||||
|
spec:
|
||||||
|
addresses:
|
||||||
|
- 10.240.0.100-10.240.0.250
|
||||||
|
EOF
|
||||||
|
become_user: fenix
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
|
||||||
|
- name: Criar anúncio L2
|
||||||
|
shell: |
|
||||||
|
cat <<EOF | kubectl apply -f -
|
||||||
|
apiVersion: metallb.io/v1beta1
|
||||||
|
kind: L2Advertisement
|
||||||
|
metadata:
|
||||||
|
name: advert
|
||||||
|
namespace: metallb-system
|
||||||
|
EOF
|
||||||
|
become_user: fenix
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Get kubeadm join command
|
- name: Get kubeadm join command
|
||||||
become: true
|
become: true
|
||||||
shell: kubeadm token create --print-join-command
|
shell: kubeadm token create --print-join-command
|
||||||
|
|||||||
@ -10,7 +10,7 @@ with open("/tmp/kube-flannel.yml", "r") as f:
|
|||||||
for doc in docs:
|
for doc in docs:
|
||||||
if doc.get("kind") == "ConfigMap" and doc.get("metadata", {}).get("name") == "kube-flannel-cfg":
|
if doc.get("kind") == "ConfigMap" and doc.get("metadata", {}).get("name") == "kube-flannel-cfg":
|
||||||
doc["data"]["net-conf.json"] = '''{
|
doc["data"]["net-conf.json"] = '''{
|
||||||
"Network": "10.244.0.0/16",
|
"Network": "10.240.0.0/16",
|
||||||
"Backend": {
|
"Backend": {
|
||||||
"Type": "vxlan"
|
"Type": "vxlan"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -88,6 +88,7 @@
|
|||||||
- kubelet
|
- kubelet
|
||||||
- kubeadm
|
- kubeadm
|
||||||
- kubectl
|
- kubectl
|
||||||
|
- nfs-common
|
||||||
state: present
|
state: present
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
|
|
||||||
@ -161,3 +162,5 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
54
roles/lazylibrarian/files/lazylibrarian-deployment.yaml
Normal file
54
roles/lazylibrarian/files/lazylibrarian-deployment.yaml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: lazylibrarian
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: lazylibrarian
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: lazylibrarian
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: lazylibrarian
|
||||||
|
image: lscr.io/linuxserver/lazylibrarian:latest
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
ports:
|
||||||
|
- containerPort: 5299
|
||||||
|
name: webui
|
||||||
|
env:
|
||||||
|
- name: PUID
|
||||||
|
value: "1013"
|
||||||
|
- name: PGID
|
||||||
|
value: "1013"
|
||||||
|
- name: TZ
|
||||||
|
value: 'Etc/UTC'
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /config
|
||||||
|
- name: books
|
||||||
|
mountPath: /books
|
||||||
|
- name: downloads
|
||||||
|
mountPath: /downloads
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: lazylibrarian-config-pvc
|
||||||
|
- name: books
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: lazylibrarian-books-pvc
|
||||||
|
- name: downloads
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: qbittorrent-downloads-pvc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
roles/lazylibrarian/files/lazylibrarian-nfs-csi.yaml
Normal file
11
roles/lazylibrarian/files/lazylibrarian-nfs-csi.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: lazylibrarian-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/lazylibrarian
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
60
roles/lazylibrarian/files/lazylibrarian-pvcs.yaml
Normal file
60
roles/lazylibrarian/files/lazylibrarian-pvcs.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: lazylibrarian-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 20Gi
|
||||||
|
storageClassName: lazylibrarian-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/lazylibrarian/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: lazylibrarian-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: lazylibrarian-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: lazylibrarian-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 20Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: lazylibrarian-media-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 150Gi
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series/Livros
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: lazylibrarian-books-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: lazylibrarian-media-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 150Gi
|
||||||
|
---
|
||||||
12
roles/lazylibrarian/files/lazylibrarian-service.yaml
Normal file
12
roles/lazylibrarian/files/lazylibrarian-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: lazylibrarian-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 5299
|
||||||
|
targetPort: 5299
|
||||||
|
selector:
|
||||||
|
app: lazylibrarian
|
||||||
|
type: ClusterIP
|
||||||
51
roles/lazylibrarian/tasks/main.yml
Normal file
51
roles/lazylibrarian/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/lazylibrarian/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/lazylibrarian/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/lazylibrarian/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/lazylibrarian/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Obter várias notas do Bitwarden
|
||||||
|
# shell: |
|
||||||
|
# echo "unlock"
|
||||||
|
# BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
# echo "get item"
|
||||||
|
# bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
# loop:
|
||||||
|
# - { id: "iac.ansible.stackarr.lazylibrarian.secret", dest: "/tmp/stack-arr/lazylibrarian/kubernetes-files/files/lazylibrarian-secret.yaml" }
|
||||||
|
# args:
|
||||||
|
# executable: /bin/bash
|
||||||
|
# environment:
|
||||||
|
# BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/lazylibrarian/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/lazylibrarian/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/lazylibrarian/vars/main.yml
Normal file
4
roles/lazylibrarian/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
26
roles/libreTranslate/files/libretranslate-deployment.yaml
Normal file
26
roles/libreTranslate/files/libretranslate-deployment.yaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: libretranslate
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: libretranslate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: libretranslate
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: libretranslate
|
||||||
|
image: libretranslate/libretranslate:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 5000
|
||||||
|
env:
|
||||||
|
- name: LT_HTTP_HOST
|
||||||
|
value: "0.0.0.0"
|
||||||
|
- name: LT_HTTP_PORT
|
||||||
|
value: "5000"
|
||||||
|
|
||||||
12
roles/libreTranslate/files/libretranslate-service.yaml
Normal file
12
roles/libreTranslate/files/libretranslate-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: libretranslate-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 5000
|
||||||
|
targetPort: 5000
|
||||||
|
selector:
|
||||||
|
app: libretranslate
|
||||||
|
type: ClusterIP
|
||||||
51
roles/libreTranslate/tasks/main.yml
Normal file
51
roles/libreTranslate/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/libreTranslate/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/libreTranslate/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/libreTranslate/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/libreTranslate/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Obter várias notas do Bitwarden
|
||||||
|
# shell: |
|
||||||
|
# echo "unlock"
|
||||||
|
# BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
# echo "get item"
|
||||||
|
# bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
# loop:
|
||||||
|
# - { id: "iac.ansible.stackarr.radarr.secret", dest: "/tmp/stack-arr/radarr/kubernetes-files/files/radarr-secret.yaml" }
|
||||||
|
# args:
|
||||||
|
# executable: /bin/bash
|
||||||
|
# environment:
|
||||||
|
# BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/libreTranslate/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/libreTranslate/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/libreTranslate/vars/main.yml
Normal file
4
roles/libreTranslate/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
79
roles/lidarr/files/lidarr-deployment.yaml
Normal file
79
roles/lidarr/files/lidarr-deployment.yaml
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: lidarr
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: lidarr
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: lidarr
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: lidarr
|
||||||
|
image: ghcr.io/hotio/lidarr:release-563b232
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
ports:
|
||||||
|
- containerPort: 8686
|
||||||
|
name: webui
|
||||||
|
env:
|
||||||
|
- name: PUID
|
||||||
|
value: "1013"
|
||||||
|
- name: PGID
|
||||||
|
value: "1013"
|
||||||
|
- name: TZ
|
||||||
|
value: 'Etc/UTC'
|
||||||
|
- name: LIDARR__POSTGRES__HOST
|
||||||
|
value: 'stolon-proxy-service.postgresql.svc.cluster.local'
|
||||||
|
- name: LIDARR__POSTGRES__PORT
|
||||||
|
value: '5432'
|
||||||
|
- name: LIDARR__POSTGRES__USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: lidarr-secret
|
||||||
|
key: username
|
||||||
|
- name: LIDARR__POSTGRES__PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: lidarr-secret
|
||||||
|
key: password
|
||||||
|
- name: LIDARR__POSTGRES__MAINDB
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: lidarr-secret
|
||||||
|
key: maindb
|
||||||
|
- name: LIDARR__POSTGRES__LOGDB
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: lidarr-secret
|
||||||
|
key: logsdb
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /config
|
||||||
|
- name: downloads
|
||||||
|
mountPath: /downloads
|
||||||
|
- name: music
|
||||||
|
mountPath: /data
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: lidarr-config-pvc
|
||||||
|
- name: downloads
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: qbittorrent-downloads-pvc
|
||||||
|
- name: music
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: lidarr-music-pvc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
23
roles/lidarr/files/lidarr-nfs-csi.yaml
Normal file
23
roles/lidarr/files/lidarr-nfs-csi.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: lidarr-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/lidarr
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
|
---
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: lidarr-music-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series/Musicas
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
60
roles/lidarr/files/lidarr-pvcs.yaml
Normal file
60
roles/lidarr/files/lidarr-pvcs.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: lidarr-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 2Gi
|
||||||
|
storageClassName: lidarr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/lidarr/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: lidarr-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: lidarr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: lidarr-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: lidarr-music-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 50Gi
|
||||||
|
storageClassName: lidarr-music-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series/Musicas
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: lidarr-music-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: lidarr-music-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: lidarr-music-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 50Gi
|
||||||
|
---
|
||||||
11
roles/lidarr/files/lidarr-secret.yaml
Normal file
11
roles/lidarr/files/lidarr-secret.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: lidarr-secret
|
||||||
|
namespace: stack-arr
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
username: dXNlcm5hbWU=
|
||||||
|
password: cGFzc3dvcmQ=
|
||||||
|
maindb: bWFpbmRiLXByb3dsYXJy
|
||||||
|
logsdb: bG9nZGItcHJvd2xhcnI=
|
||||||
12
roles/lidarr/files/lidarr-service.yaml
Normal file
12
roles/lidarr/files/lidarr-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: lidarr-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 8686
|
||||||
|
targetPort: 8686
|
||||||
|
selector:
|
||||||
|
app: lidarr
|
||||||
|
type: ClusterIP
|
||||||
51
roles/lidarr/tasks/main.yml
Normal file
51
roles/lidarr/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/lidarr/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/lidarr/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/lidarr/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/lidarr/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Obter várias notas do Bitwarden
|
||||||
|
shell: |
|
||||||
|
echo "unlock"
|
||||||
|
BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
echo "get item"
|
||||||
|
bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
loop:
|
||||||
|
- { id: "iac.ansible.stackarr.lidarr.secret", dest: "/tmp/stack-arr/lidarr/kubernetes-files/files/lidarr-secret.yaml" }
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
environment:
|
||||||
|
BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/lidarr/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/lidarr/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/lidarr/vars/main.yml
Normal file
4
roles/lidarr/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
24
roles/lingarr/files/lingarr-configmap.yaml
Normal file
24
roles/lingarr/files/lingarr-configmap.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: lingarr-configmap
|
||||||
|
namespace: stack-arr
|
||||||
|
data:
|
||||||
|
Lingarr.Server.runtimeconfig.json: |
|
||||||
|
{
|
||||||
|
"runtimeOptions": {
|
||||||
|
"tfm": "net9.0",
|
||||||
|
"frameworks": [
|
||||||
|
{ "name": "Microsoft.NETCore.App", "version": "9.0.0" },
|
||||||
|
{ "name": "Microsoft.AspNetCore.App", "version": "9.0.0" }
|
||||||
|
],
|
||||||
|
"configProperties": {
|
||||||
|
"System.GC.Server": true,
|
||||||
|
"System.Globalization.Invariant": false,
|
||||||
|
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
||||||
|
"System.Reflection.NullabilityInfoContext.IsSupported": true,
|
||||||
|
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
|
||||||
|
"Npgsql.EnableLegacyTimestampBehavior": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
76
roles/lingarr/files/lingarr-deployment.yaml
Normal file
76
roles/lingarr/files/lingarr-deployment.yaml
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: lingarr
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: lingarr
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: lingarr
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: lingarr
|
||||||
|
image: lingarr/lingarr:main
|
||||||
|
ports:
|
||||||
|
- containerPort: 9876
|
||||||
|
env:
|
||||||
|
- name: TZ
|
||||||
|
value: "UTC"
|
||||||
|
- name: ASPNETCORE_URLS
|
||||||
|
value: "http://+:9876"
|
||||||
|
- name: WHISPER_BASE_URL
|
||||||
|
value: "http://whisperasr-service.stack-arr.svc.cluster.local:9000"
|
||||||
|
- name: SOURCE_LANGUAGE
|
||||||
|
value: "auto"
|
||||||
|
- name: TARGET_LANGUAGE
|
||||||
|
value: "pt"
|
||||||
|
- name: DB_CONNECTION
|
||||||
|
value: postgresql
|
||||||
|
- name: DB_HOST
|
||||||
|
value: 'stolon-proxy-service.postgresql.svc.cluster.local'
|
||||||
|
- name: DB_PORT
|
||||||
|
value: '5432'
|
||||||
|
- name: DB_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: lingarr-secret
|
||||||
|
key: username
|
||||||
|
- name: DB_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: lingarr-secret
|
||||||
|
key: password
|
||||||
|
- name: DB_DATABASE
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: lingarr-secret
|
||||||
|
key: maindb
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /app/config
|
||||||
|
- name: runtimeconfig
|
||||||
|
mountPath: /app/Lingarr.Server.runtimeconfig.json
|
||||||
|
subPath: Lingarr.Server.runtimeconfig.json
|
||||||
|
readOnly: true
|
||||||
|
- name: tv
|
||||||
|
mountPath: /tv
|
||||||
|
- name: anime
|
||||||
|
mountPath: /anime
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: lingarr-config-pvc
|
||||||
|
- name: runtimeconfig
|
||||||
|
configMap:
|
||||||
|
name: lingarr-configmap
|
||||||
|
- name: tv
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: sonarr-tv-pvc
|
||||||
|
- name: anime
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: sonarr-anime-pvc
|
||||||
11
roles/lingarr/files/lingarr-nfs-csi.yaml
Normal file
11
roles/lingarr/files/lingarr-nfs-csi.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: lingarr-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/lingarr
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
29
roles/lingarr/files/lingarr-pvcs.yaml
Normal file
29
roles/lingarr/files/lingarr-pvcs.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: lingarr-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 10Gi
|
||||||
|
storageClassName: lingarr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/lingarr/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: lingarr-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: lingarr-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: lingarr-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 10Gi
|
||||||
10
roles/lingarr/files/lingarr-secret.yaml
Normal file
10
roles/lingarr/files/lingarr-secret.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: lingarr-secret
|
||||||
|
namespace: stack-arr
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
username: dXNlcm5hbWU=
|
||||||
|
password: cGFzc3dvcmQ=
|
||||||
|
maindb: bWFpbmRiLXByb3dsYXJy
|
||||||
12
roles/lingarr/files/lingarr-service.yaml
Normal file
12
roles/lingarr/files/lingarr-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: lingarr-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 9876
|
||||||
|
targetPort: 9876
|
||||||
|
selector:
|
||||||
|
app: lingarr
|
||||||
|
type: ClusterIP
|
||||||
51
roles/lingarr/tasks/main.yml
Normal file
51
roles/lingarr/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/lingarr/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/lingarr/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/lingarr/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/lingarr/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Obter várias notas do Bitwarden
|
||||||
|
shell: |
|
||||||
|
echo "unlock"
|
||||||
|
BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
echo "get item"
|
||||||
|
bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
loop:
|
||||||
|
- { id: "iac.ansible.stackarr.lingarr.secret", dest: "/tmp/stack-arr/lingarr/kubernetes-files/files/lingarr-secret.yaml" }
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
environment:
|
||||||
|
BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/lingarr/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/lingarr/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/lingarr/vars/main.yml
Normal file
4
roles/lingarr/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
90
roles/mangareader/files/mangareader-deployment.yaml
Normal file
90
roles/mangareader/files/mangareader-deployment.yaml
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: mangareader
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: mangareader
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: mangareader
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 1013
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
containers:
|
||||||
|
- name: mangareader
|
||||||
|
image: ghcr.io/suwayomi/tachidesk:v2.1.2061
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_ADMIN
|
||||||
|
ports:
|
||||||
|
- containerPort: 4567
|
||||||
|
name: webui
|
||||||
|
env:
|
||||||
|
- name: PUID
|
||||||
|
value: "1013"
|
||||||
|
- name: PGID
|
||||||
|
value: "1013"
|
||||||
|
- name: TZ
|
||||||
|
value: 'Etc/UTC'
|
||||||
|
- name: AUTO_DOWNLOAD_CHAPTERS
|
||||||
|
value: 'true'
|
||||||
|
- name: AUTO_BACKUP_INCLUDE_MANGA
|
||||||
|
value: 'false'
|
||||||
|
- name: AUTO_BACKUP_INCLUDE_CATEGORIES
|
||||||
|
value: 'false'
|
||||||
|
- name: AUTO_BACKUP_INCLUDE_CHAPTERS
|
||||||
|
value: 'false'
|
||||||
|
- name: AUTO_BACKUP_INCLUDE_TRACKING
|
||||||
|
value: 'false'
|
||||||
|
- name: AUTO_BACKUP_INCLUDE_HISTORY
|
||||||
|
value: 'false'
|
||||||
|
- name: AUTO_BACKUP_INCLUDE_CLIENT_DATA
|
||||||
|
value: 'false'
|
||||||
|
- name: AUTO_BACKUP_INCLUDE_SERVER_SETTINGS
|
||||||
|
value: 'false'
|
||||||
|
- name: FLARESOLVERR_ENABLED
|
||||||
|
value: 'true'
|
||||||
|
- name: FLARESOLVERR_URL
|
||||||
|
value: 'http://flaresolverr-service.stack-arr.svc.cluster.local:8191'
|
||||||
|
- name: DATABASE_TYPE
|
||||||
|
value: 'POSTGRESQL'
|
||||||
|
- name: DATABASE_URL
|
||||||
|
value: 'postgresql://stolon-proxy-service.postgresql.svc.cluster.local:5432/mangareader'
|
||||||
|
- name: DATABASE_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mangareader-secret
|
||||||
|
key: username
|
||||||
|
- name: DATABASE_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: mangareader-secret
|
||||||
|
key: password
|
||||||
|
volumeMounts:
|
||||||
|
- name: config
|
||||||
|
mountPath: /home/suwayomi/.local/share/Tachidesk
|
||||||
|
- name: books
|
||||||
|
mountPath: /books
|
||||||
|
- name: downloads
|
||||||
|
mountPath: /downloads
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: mangareader-config-pvc
|
||||||
|
- name: books
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: mangareader-books-pvc
|
||||||
|
- name: downloads
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: qbittorrent-downloads-pvc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
roles/mangareader/files/mangareader-nfs-csi.yaml
Normal file
11
roles/mangareader/files/mangareader-nfs-csi.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: mangareader-nfs-csi
|
||||||
|
namespace: stack-arr
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/mangareader
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
60
roles/mangareader/files/mangareader-pvcs.yaml
Normal file
60
roles/mangareader/files/mangareader-pvcs.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: mangareader-config-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 20Gi
|
||||||
|
storageClassName: mangareader-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/mangareader/config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: mangareader-config-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: mangareader-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: mangareader-config-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 20Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: mangareader-media-pv
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 150Gi
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series/Livros
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: mangareader-books-pvc
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
storageClassName: jellyfin-videos-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: mangareader-media-pv
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 150Gi
|
||||||
|
---
|
||||||
9
roles/mangareader/files/mangareader-secret.yaml
Normal file
9
roles/mangareader/files/mangareader-secret.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: mangareader-secret
|
||||||
|
namespace: stack-arr
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
username: dXNlcm5hbWU=
|
||||||
|
password: cGFzc3dvcmQ=
|
||||||
12
roles/mangareader/files/mangareader-service.yaml
Normal file
12
roles/mangareader/files/mangareader-service.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: mangareader-service
|
||||||
|
namespace: stack-arr
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 4567
|
||||||
|
targetPort: 4567
|
||||||
|
selector:
|
||||||
|
app: mangareader
|
||||||
|
type: ClusterIP
|
||||||
51
roles/mangareader/tasks/main.yml
Normal file
51
roles/mangareader/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
- name: Remover o diretório /tmp/stack-arr/mangareader/kubernetes-files
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/stack-arr/mangareader/kubernetes-files
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Criar diretório temporário no remoto
|
||||||
|
file:
|
||||||
|
path: /tmp/stack-arr/mangareader/kubernetes-files
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy file with owner and permissions
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: ../files
|
||||||
|
dest: /tmp/stack-arr/mangareader/kubernetes-files
|
||||||
|
owner: fenix
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
|
||||||
|
- name: Obter várias notas do Bitwarden
|
||||||
|
shell: |
|
||||||
|
echo "unlock"
|
||||||
|
BW_SESSION=$(bw unlock {{ bw_password }} --raw)
|
||||||
|
echo "get item"
|
||||||
|
bw get item "{{ item.id }}" --session $BW_SESSION | jq -r '.notes' > {{ item.dest }}
|
||||||
|
loop:
|
||||||
|
- { id: "iac.ansible.stackarr.mangareader.secret", dest: "/tmp/stack-arr/mangareader/kubernetes-files/files/mangareader-secret.yaml" }
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
environment:
|
||||||
|
BW_PASSWORD: "{{ BW_PASSWORD }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Listar conteúdo do diretório remoto
|
||||||
|
shell: ls -l /tmp/stack-arr/mangareader/kubernetes-files/files
|
||||||
|
register: resultado_ls
|
||||||
|
|
||||||
|
|
||||||
|
- name: Mostrar resultado do ls
|
||||||
|
debug:
|
||||||
|
var: resultado_ls.stdout_lines
|
||||||
|
|
||||||
|
|
||||||
|
- name: Aplicar o stolon
|
||||||
|
become: yes
|
||||||
|
become_user: fenix
|
||||||
|
shell: |
|
||||||
|
kubectl apply -f /tmp/stack-arr/mangareader/kubernetes-files/files/
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
4
roles/mangareader/vars/main.yml
Normal file
4
roles/mangareader/vars/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bw_password: "{{ lookup('env', 'BW_PASSWORD') }}"
|
||||||
|
VAULTWARDEN_LINK: "{{ lookup('env', 'VAULTWARDEN_LINK') }}"
|
||||||
|
BW_CLIENTID: "{{ lookup('env', 'BW_CLIENTID') }}"
|
||||||
|
BW_CLIENTSECRET : "{{ lookup('env', 'BW_CLIENTSECRET') }}"
|
||||||
9
roles/mariadb/files/docker-secrets.yaml
Normal file
9
roles/mariadb/files/docker-secrets.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: regcred
|
||||||
|
namespace: mariadb
|
||||||
|
data:
|
||||||
|
.dockerconfigjson: >-
|
||||||
|
eyJhdXRocyI6eyJodHRwczovL2luZGV4LmRvY2tlci5pby92MS8iOnsidXNlcm5hbWUiOiJ1c2VyIiwicGFzc3dvcmQiOiJwYXNzIiwiYXV0aCI6ImRmamlla2ZlcldFS1dFa29mY2RrbzM0MzUzZmQ9In19fQ==
|
||||||
|
type: kubernetes.io/dockerconfigjson
|
||||||
10
roles/mariadb/files/mariadb-configmap.yaml
Normal file
10
roles/mariadb/files/mariadb-configmap.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: mariadb-config
|
||||||
|
namespace: mariadb
|
||||||
|
data:
|
||||||
|
my.cnf: |
|
||||||
|
[mysqld]
|
||||||
|
innodb_use_native_aio=0
|
||||||
|
innodb_flush_method=fsync
|
||||||
4
roles/mariadb/files/mariadb-namespace.yaml
Normal file
4
roles/mariadb/files/mariadb-namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: mariadb
|
||||||
11
roles/mariadb/files/mariadb-nfs-csi.yaml
Normal file
11
roles/mariadb/files/mariadb-nfs-csi.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: mariadb-nfs-csi
|
||||||
|
namespace: mariadb
|
||||||
|
provisioner: nfs.csi.k8s.io
|
||||||
|
parameters:
|
||||||
|
server: 192.168.1.22
|
||||||
|
share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/mariadb
|
||||||
|
allowVolumeExpansion: true
|
||||||
|
reclaimPolicy: Retain
|
||||||
31
roles/mariadb/files/mariadb-pvcs.yaml
Normal file
31
roles/mariadb/files/mariadb-pvcs.yaml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: mariadb-pv-0
|
||||||
|
namespace: mariadb
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 50Gi
|
||||||
|
storageClassName: mariadb-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
persistentVolumeReclaimPolicy: Retain
|
||||||
|
nfs:
|
||||||
|
server: 192.168.1.22
|
||||||
|
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/mariadb
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: mariadb-data-mariadb-statefulset-0
|
||||||
|
namespace: mariadb
|
||||||
|
spec:
|
||||||
|
storageClassName: mariadb-nfs-csi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
volumeName: mariadb-pv-0
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 50Gi
|
||||||
|
---
|
||||||
|
|
||||||
11
roles/mariadb/files/mariadb-secret.yaml
Normal file
11
roles/mariadb/files/mariadb-secret.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: mariadb-secret
|
||||||
|
namespace: mariadb
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
MARIADB_ROOT_PASSWORD: TUFSSUFEQl9ST09UX1BBU1NXT1JE
|
||||||
|
MARIADB_DATABASE: TUFSSUFEQl9EQVRBQkFTRQ==
|
||||||
|
MARIADB_USER: TUFSSUFEQl9VU0VS
|
||||||
|
MARIADB_PASSWORD: TUFSSUFEQl9QQVNTV09SRA==
|
||||||
13
roles/mariadb/files/mariadb-service.yaml
Normal file
13
roles/mariadb/files/mariadb-service.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: mariadb-service
|
||||||
|
namespace: mariadb
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 3306
|
||||||
|
targetPort: 3306
|
||||||
|
selector:
|
||||||
|
app: mariadb-statefulset
|
||||||
|
type: LoadBalancer
|
||||||
|
loadBalancerIP: 10.240.0.102
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user