From d5ecd4f2d1b1bbeda2772c5508e802c3ac7ed691 Mon Sep 17 00:00:00 2001 From: mg Date: Fri, 5 Nov 2021 20:52:31 +0100 Subject: [PATCH] Rolle: bdfr entfernt (#236) Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/236 Co-authored-by: mg Co-committed-by: mg --- roles/mgrote.bdfr/README.md | 23 ----------- roles/mgrote.bdfr/defaults/main.yml | 4 -- roles/mgrote.bdfr/tasks/main.yml | 40 -------------------- roles/mgrote.bdfr/templates/bdfr_download.sh | 35 ----------------- roles/mgrote.bdfr/templates/logrotate_config | 14 ------- 5 files changed, 116 deletions(-) delete mode 100644 roles/mgrote.bdfr/README.md delete mode 100644 roles/mgrote.bdfr/defaults/main.yml delete mode 100644 roles/mgrote.bdfr/tasks/main.yml delete mode 100644 roles/mgrote.bdfr/templates/bdfr_download.sh delete mode 100644 roles/mgrote.bdfr/templates/logrotate_config diff --git a/roles/mgrote.bdfr/README.md b/roles/mgrote.bdfr/README.md deleted file mode 100644 index 358ff7b4..00000000 --- a/roles/mgrote.bdfr/README.md +++ /dev/null @@ -1,23 +0,0 @@ -## mgrote.bdfr - -Installiert [Bulk Downloader for Reddit](https://github.com/aliparlakci/bulk-downloader-for-reddit#configuration). -Erstellt einen Cronjob. - -__Benötigt einen Webbrowser!__ - -### getestet auf -- [ Linux Mint (>20.1) - - -### Variablen + Defaults -see [defaults](./defaults/main.yml) - - -## Script einrichten(Token von Reddit holen) -1. Script ausführen `bdfr_download.sh` -2. Link anklicken -3. bei Reddit anmelden -4. Download... - -## to HTML -* https://github.com/BlipRanger/bdfr-html diff --git a/roles/mgrote.bdfr/defaults/main.yml b/roles/mgrote.bdfr/defaults/main.yml deleted file mode 100644 index 0b68977b..00000000 --- a/roles/mgrote.bdfr/defaults/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - bdfr_data_path: /mnt/bdfr/reddit - bdfr_data_mount: /mnt/bdfr - bdfr_log_file: /var/log/bdfr.log diff --git a/roles/mgrote.bdfr/tasks/main.yml b/roles/mgrote.bdfr/tasks/main.yml deleted file mode 100644 index 8e6722c2..00000000 --- a/roles/mgrote.bdfr/tasks/main.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- - - name: install python3.9 - become: yes - ansible.builtin.package: - name: - - python3.9 - - python3-pip - state: present - - - name: Install bdfr - become: yes - shell: python3.9 -m pip install bdfr --upgrade - changed_when: False - - - name: copy bdfr_download.sh - become: yes - ansible.builtin.template: - src: "bdfr_download.sh" - dest: "/usr/local/bin/bdfr_download.sh" - mode: 0755 - owner: mg - group: mg - - - name: create cronjob - become: true - ansible.builtin.cron: - name: bdfr - minute: "41" - hour: "2" - job: "/usr/local/bin/bdfr_download.sh >> {{ bdfr_log_file }}" - state: present - - - name: copy logrotate config - become: yes - ansible.builtin.template: - src: logrotate_config - dest: /etc/logrotate.d/bdfr - owner: root - group: root - mode: 0644 diff --git a/roles/mgrote.bdfr/templates/bdfr_download.sh b/roles/mgrote.bdfr/templates/bdfr_download.sh deleted file mode 100644 index 7d997b94..00000000 --- a/roles/mgrote.bdfr/templates/bdfr_download.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -{{ file_header | default () }} - -chmod +x /home/mg/.config/bdfr/default_config.cfg - -# These functions return exit codes: 0 = found, 1 = not found -# https://serverfault.com/questions/50585/whats-the-best-way-to-check-if-a-volume-is-mounted-in-a-bash-script -isMounted () { findmnt -rno SOURCE,TARGET "$1" >/dev/null;} #path or device - -#!/bin/bash -{{ file_header | default () }} -LOCKDIR=${HOME}/.cache # set lockdir -function exlock() { # define Function for setting lock; stops the script i a lock exists - exec {lock_fd}>${LOCKDIR}/$(basename $0).lock - flock -nx "$lock_fd" - if [[ $? == 1 ]]; then - exit 1 - fi -} -function unlock() { # define function for removing lock - rm "${LOCKDIR}/$(basename $0).lock" - [[ -n $1 ]] && exit $1 - exit -} - -exlock # set lock -if isMounted "{{ bdfr_data_mount }}"; - then - python3.9 -m bdfr clone {{ bdfr_data_path }} --no-dupes --search-existing --submitted --upvoted --saved --authenticate --user me - python3.9 -m bdfr clone {{ bdfr_data_path }} --no-dupes --search-existing --subreddit SCPDeclassified - else echo "share is not mounted" - exit 1 -fi - -unlock # entferne lock diff --git a/roles/mgrote.bdfr/templates/logrotate_config b/roles/mgrote.bdfr/templates/logrotate_config deleted file mode 100644 index e0caa767..00000000 --- a/roles/mgrote.bdfr/templates/logrotate_config +++ /dev/null @@ -1,14 +0,0 @@ -{{ file_header | default () }} -{{ bdfr_log_file }} { - missingok - nocreate - rotate 4 - weekly - compress - missingok - notifempty - dateext - dateyesterday - sharedscripts - endscript -}