diff --git a/playbook.yml b/playbook.yml index 3422b9d..ce1b434 100644 --- a/playbook.yml +++ b/playbook.yml @@ -37,4 +37,5 @@ - libreTranslate - lingarr - cripto - - anchorr \ No newline at end of file + - anchorr + - lazylibrarian \ No newline at end of file diff --git a/roles/bookshelf/files/bookshelf-deployment.yaml b/roles/bookshelf/files/bookshelf-deployment.yaml new file mode 100644 index 0000000..42d2f66 --- /dev/null +++ b/roles/bookshelf/files/bookshelf-deployment.yaml @@ -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 + + + diff --git a/roles/bookshelf/files/bookshelf-nfs-csi.yaml b/roles/bookshelf/files/bookshelf-nfs-csi.yaml new file mode 100644 index 0000000..436c02d --- /dev/null +++ b/roles/bookshelf/files/bookshelf-nfs-csi.yaml @@ -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 \ No newline at end of file diff --git a/roles/bookshelf/files/bookshelf-pvcs.yaml b/roles/bookshelf/files/bookshelf-pvcs.yaml new file mode 100644 index 0000000..edd05d9 --- /dev/null +++ b/roles/bookshelf/files/bookshelf-pvcs.yaml @@ -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 +--- \ No newline at end of file diff --git a/roles/bookshelf/files/bookshelf-service.yaml b/roles/bookshelf/files/bookshelf-service.yaml new file mode 100644 index 0000000..5130120 --- /dev/null +++ b/roles/bookshelf/files/bookshelf-service.yaml @@ -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 \ No newline at end of file diff --git a/roles/bookshelf/tasks/main.yml b/roles/bookshelf/tasks/main.yml new file mode 100644 index 0000000..fe32ece --- /dev/null +++ b/roles/bookshelf/tasks/main.yml @@ -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 \ No newline at end of file diff --git a/roles/bookshelf/vars/main.yml b/roles/bookshelf/vars/main.yml new file mode 100644 index 0000000..c8fe60b --- /dev/null +++ b/roles/bookshelf/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/lazylibrarian/files/lazylibrarian-deployment.yaml b/roles/lazylibrarian/files/lazylibrarian-deployment.yaml new file mode 100644 index 0000000..6d8006d --- /dev/null +++ b/roles/lazylibrarian/files/lazylibrarian-deployment.yaml @@ -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 + + + diff --git a/roles/lazylibrarian/files/lazylibrarian-nfs-csi.yaml b/roles/lazylibrarian/files/lazylibrarian-nfs-csi.yaml new file mode 100644 index 0000000..4a76c82 --- /dev/null +++ b/roles/lazylibrarian/files/lazylibrarian-nfs-csi.yaml @@ -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 \ No newline at end of file diff --git a/roles/lazylibrarian/files/lazylibrarian-pvcs.yaml b/roles/lazylibrarian/files/lazylibrarian-pvcs.yaml new file mode 100644 index 0000000..14b9be0 --- /dev/null +++ b/roles/lazylibrarian/files/lazylibrarian-pvcs.yaml @@ -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 +--- \ No newline at end of file diff --git a/roles/lazylibrarian/files/lazylibrarian-service.yaml b/roles/lazylibrarian/files/lazylibrarian-service.yaml new file mode 100644 index 0000000..669c812 --- /dev/null +++ b/roles/lazylibrarian/files/lazylibrarian-service.yaml @@ -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 \ No newline at end of file diff --git a/roles/lazylibrarian/tasks/main.yml b/roles/lazylibrarian/tasks/main.yml new file mode 100644 index 0000000..3339665 --- /dev/null +++ b/roles/lazylibrarian/tasks/main.yml @@ -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 \ No newline at end of file diff --git a/roles/lazylibrarian/vars/main.yml b/roles/lazylibrarian/vars/main.yml new file mode 100644 index 0000000..c8fe60b --- /dev/null +++ b/roles/lazylibrarian/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/mangareader/files/mangareader-deployment.yaml b/roles/mangareader/files/mangareader-deployment.yaml new file mode 100644 index 0000000..c4a506f --- /dev/null +++ b/roles/mangareader/files/mangareader-deployment.yaml @@ -0,0 +1,88 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mangareader + namespace: stack-arr +spec: + replicas: 1 + selector: + matchLabels: + app: mangareader + template: + metadata: + labels: + app: mangareader + spec: + imagePullSecrets: + - name: regcred + containers: + - name: mangareader + image: ghcr.io/suwayomi/tachidesk:v2.1.2060 + 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: /config + - 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 + + + diff --git a/roles/mangareader/files/mangareader-nfs-csi.yaml b/roles/mangareader/files/mangareader-nfs-csi.yaml new file mode 100644 index 0000000..7632fa9 --- /dev/null +++ b/roles/mangareader/files/mangareader-nfs-csi.yaml @@ -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 \ No newline at end of file diff --git a/roles/mangareader/files/mangareader-pvcs.yaml b/roles/mangareader/files/mangareader-pvcs.yaml new file mode 100644 index 0000000..14b9be0 --- /dev/null +++ b/roles/mangareader/files/mangareader-pvcs.yaml @@ -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 +--- \ No newline at end of file diff --git a/roles/mangareader/files/mangareader-secret.yaml b/roles/mangareader/files/mangareader-secret.yaml new file mode 100644 index 0000000..cf7573d --- /dev/null +++ b/roles/mangareader/files/mangareader-secret.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: mangareader-secret + namespace: stack-arr +type: Opaque +data: + username: dXNlcm5hbWU= + password: cGFzc3dvcmQ= \ No newline at end of file diff --git a/roles/mangareader/files/mangareader-service.yaml b/roles/mangareader/files/mangareader-service.yaml new file mode 100644 index 0000000..f661e2a --- /dev/null +++ b/roles/mangareader/files/mangareader-service.yaml @@ -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 \ No newline at end of file diff --git a/roles/mangareader/tasks/main.yml b/roles/mangareader/tasks/main.yml new file mode 100644 index 0000000..7a19804 --- /dev/null +++ b/roles/mangareader/tasks/main.yml @@ -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 \ No newline at end of file diff --git a/roles/mangareader/vars/main.yml b/roles/mangareader/vars/main.yml new file mode 100644 index 0000000..c8fe60b --- /dev/null +++ b/roles/mangareader/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/shelfarr/files/shelfarr-deployment.yaml b/roles/shelfarr/files/shelfarr-deployment.yaml new file mode 100644 index 0000000..8c6c3e9 --- /dev/null +++ b/roles/shelfarr/files/shelfarr-deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: shelfarr + namespace: stack-arr +spec: + replicas: 1 + selector: + matchLabels: + app: shelfarr + template: + metadata: + labels: + app: shelfarr + spec: + imagePullSecrets: + - name: regcred + containers: + - name: shelfarr + image: ghcr.io/pedro-revez-silva/shelfarr:c49adad + securityContext: + capabilities: + add: + - NET_ADMIN + ports: + - containerPort: 5056 + name: webui + env: + - name: PUID + value: "1013" + - name: PGID + value: "1013" + - name: HTTP_PORT + value: "5056" + - name: TZ + value: 'Etc/UTC' + volumeMounts: + - name: config + mountPath: /rails/storage + - name: books + mountPath: /books + - name: downloads + mountPath: /downloads + volumes: + - name: config + persistentVolumeClaim: + claimName: shelfarr-config-pvc + - name: books + persistentVolumeClaim: + claimName: shelfarr-books-pvc + - name: downloads + persistentVolumeClaim: + claimName: qbittorrent-downloads-pvc + + + diff --git a/roles/shelfarr/files/shelfarr-nfs-csi.yaml b/roles/shelfarr/files/shelfarr-nfs-csi.yaml new file mode 100644 index 0000000..4462496 --- /dev/null +++ b/roles/shelfarr/files/shelfarr-nfs-csi.yaml @@ -0,0 +1,11 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: shelfarr-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/shelfarr +allowVolumeExpansion: true +reclaimPolicy: Retain \ No newline at end of file diff --git a/roles/shelfarr/files/shelfarr-pvcs.yaml b/roles/shelfarr/files/shelfarr-pvcs.yaml new file mode 100644 index 0000000..0b6b2b7 --- /dev/null +++ b/roles/shelfarr/files/shelfarr-pvcs.yaml @@ -0,0 +1,60 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: shelfarr-config-pv + namespace: stack-arr +spec: + capacity: + storage: 20Gi + storageClassName: shelfarr-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/shelfarr/config +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: shelfarr-config-pvc + namespace: stack-arr +spec: + storageClassName: shelfarr-nfs-csi + accessModes: + - ReadWriteOnce + volumeName: shelfarr-config-pv + resources: + requests: + storage: 20Gi +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: shelfarr-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: shelfarr-books-pvc + namespace: stack-arr +spec: + storageClassName: jellyfin-videos-nfs-csi + accessModes: + - ReadWriteOnce + volumeName: shelfarr-media-pv + resources: + requests: + storage: 150Gi +--- \ No newline at end of file diff --git a/roles/shelfarr/files/shelfarr-service.yaml b/roles/shelfarr/files/shelfarr-service.yaml new file mode 100644 index 0000000..73fa912 --- /dev/null +++ b/roles/shelfarr/files/shelfarr-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: shelfarr-service + namespace: stack-arr +spec: + ports: + - port: 5056 + targetPort: 5056 + selector: + app: shelfarr + type: ClusterIP \ No newline at end of file diff --git a/roles/shelfarr/tasks/main.yml b/roles/shelfarr/tasks/main.yml new file mode 100644 index 0000000..fa0a3d1 --- /dev/null +++ b/roles/shelfarr/tasks/main.yml @@ -0,0 +1,51 @@ +- name: Remover o diretório /tmp/stack-arr/shelfarr/kubernetes-files + ansible.builtin.file: + path: /tmp/stack-arr/shelfarr/kubernetes-files + state: absent + +- name: Criar diretório temporário no remoto + file: + path: /tmp/stack-arr/shelfarr/kubernetes-files + state: directory + mode: '0755' + +- name: Copy file with owner and permissions + ansible.builtin.copy: + src: ../files + dest: /tmp/stack-arr/shelfarr/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.shelfarr.secret", dest: "/tmp/stack-arr/shelfarr/kubernetes-files/files/shelfarr-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/shelfarr/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/shelfarr/kubernetes-files/files/ + environment: + KUBECONFIG: /home/fenix/.kube/config \ No newline at end of file diff --git a/roles/shelfarr/vars/main.yml b/roles/shelfarr/vars/main.yml new file mode 100644 index 0000000..c8fe60b --- /dev/null +++ b/roles/shelfarr/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