From 9e703cf9fdbd80de7ec92fdcfefe2b02710ed07d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Limpinho?= <53994778+TomasLimpinho@users.noreply.github.com> Date: Wed, 21 Jan 2026 16:51:47 +0000 Subject: [PATCH] anchorr --- playbook.yml | 3 +- roles/anchorr/files/anchorr-deployment.yaml | 46 +++++++++++++++++ roles/anchorr/files/anchorr-nfs-csi.yaml | 11 ++++ roles/anchorr/files/anchorr-pvcs.yaml | 29 +++++++++++ roles/anchorr/files/anchorr-service.yaml | 12 +++++ roles/anchorr/tasks/main.yml | 51 +++++++++++++++++++ roles/anchorr/vars/main.yml | 4 ++ roles/jellyfin/files/jellyfin-deployment.yaml | 2 +- roles/lingarr/files/lingarr-deployment.yaml | 8 ++- roles/lingarr/files/lingarr-nfs-csi.yaml | 11 ++++ roles/lingarr/files/lingarr-pvcs.yaml | 29 +++++++++++ roles/qbittorrent/files/qbittorrent-pvcs.yaml | 2 +- 12 files changed, 204 insertions(+), 4 deletions(-) create mode 100644 roles/anchorr/files/anchorr-deployment.yaml create mode 100644 roles/anchorr/files/anchorr-nfs-csi.yaml create mode 100644 roles/anchorr/files/anchorr-pvcs.yaml create mode 100644 roles/anchorr/files/anchorr-service.yaml create mode 100644 roles/anchorr/tasks/main.yml create mode 100644 roles/anchorr/vars/main.yml create mode 100644 roles/lingarr/files/lingarr-nfs-csi.yaml create mode 100644 roles/lingarr/files/lingarr-pvcs.yaml diff --git a/playbook.yml b/playbook.yml index 2caf7e5..3422b9d 100644 --- a/playbook.yml +++ b/playbook.yml @@ -36,4 +36,5 @@ - bazarr - libreTranslate - lingarr - - cripto \ No newline at end of file + - cripto + - anchorr \ No newline at end of file diff --git a/roles/anchorr/files/anchorr-deployment.yaml b/roles/anchorr/files/anchorr-deployment.yaml new file mode 100644 index 0000000..2b0e07d --- /dev/null +++ b/roles/anchorr/files/anchorr-deployment.yaml @@ -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 + diff --git a/roles/anchorr/files/anchorr-nfs-csi.yaml b/roles/anchorr/files/anchorr-nfs-csi.yaml new file mode 100644 index 0000000..0143e70 --- /dev/null +++ b/roles/anchorr/files/anchorr-nfs-csi.yaml @@ -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 \ No newline at end of file diff --git a/roles/anchorr/files/anchorr-pvcs.yaml b/roles/anchorr/files/anchorr-pvcs.yaml new file mode 100644 index 0000000..4e7bd35 --- /dev/null +++ b/roles/anchorr/files/anchorr-pvcs.yaml @@ -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 \ No newline at end of file diff --git a/roles/anchorr/files/anchorr-service.yaml b/roles/anchorr/files/anchorr-service.yaml new file mode 100644 index 0000000..6be4bf3 --- /dev/null +++ b/roles/anchorr/files/anchorr-service.yaml @@ -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 \ No newline at end of file diff --git a/roles/anchorr/tasks/main.yml b/roles/anchorr/tasks/main.yml new file mode 100644 index 0000000..ea60611 --- /dev/null +++ b/roles/anchorr/tasks/main.yml @@ -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 \ No newline at end of file diff --git a/roles/anchorr/vars/main.yml b/roles/anchorr/vars/main.yml new file mode 100644 index 0000000..c8fe60b --- /dev/null +++ b/roles/anchorr/vars/main.yml @@ -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') }}" \ No newline at end of file diff --git a/roles/jellyfin/files/jellyfin-deployment.yaml b/roles/jellyfin/files/jellyfin-deployment.yaml index 8f995f5..d29219d 100644 --- a/roles/jellyfin/files/jellyfin-deployment.yaml +++ b/roles/jellyfin/files/jellyfin-deployment.yaml @@ -17,7 +17,7 @@ spec: - name: regcred containers: - name: jellyfin - image: lscr.io/linuxserver/jellyfin:10.11.2 + image: lscr.io/linuxserver/jellyfin:10.11.5 resources: limits: memory: "9G" # Maximum memory allowed diff --git a/roles/lingarr/files/lingarr-deployment.yaml b/roles/lingarr/files/lingarr-deployment.yaml index 449d36f..86c328c 100644 --- a/roles/lingarr/files/lingarr-deployment.yaml +++ b/roles/lingarr/files/lingarr-deployment.yaml @@ -27,4 +27,10 @@ spec: value: "auto" - name: TARGET_LANGUAGE value: "pt" - + volumeMounts: + - name: config + mountPath: /app/config + volumes: + - name: config + persistentVolumeClaim: + claimName: lingarr-config-pvc diff --git a/roles/lingarr/files/lingarr-nfs-csi.yaml b/roles/lingarr/files/lingarr-nfs-csi.yaml new file mode 100644 index 0000000..0ec896d --- /dev/null +++ b/roles/lingarr/files/lingarr-nfs-csi.yaml @@ -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 \ No newline at end of file diff --git a/roles/lingarr/files/lingarr-pvcs.yaml b/roles/lingarr/files/lingarr-pvcs.yaml new file mode 100644 index 0000000..5ea4ac0 --- /dev/null +++ b/roles/lingarr/files/lingarr-pvcs.yaml @@ -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 \ No newline at end of file diff --git a/roles/qbittorrent/files/qbittorrent-pvcs.yaml b/roles/qbittorrent/files/qbittorrent-pvcs.yaml index df2d6cd..806fa30 100644 --- a/roles/qbittorrent/files/qbittorrent-pvcs.yaml +++ b/roles/qbittorrent/files/qbittorrent-pvcs.yaml @@ -42,7 +42,7 @@ spec: persistentVolumeReclaimPolicy: Retain nfs: server: 192.168.1.22 - path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/stack-arr/bittorrent/downloads + path: /mnt/fenix-main-nas-pool-0/data/Filmes_e_Series/Downloads --- apiVersion: v1 kind: PersistentVolumeClaim