diff --git a/roles/logarr/templates/config.json.j2 b/roles/logarr/templates/config.json.j2 index e8118e4aa3..764666daab 100644 --- a/roles/logarr/templates/config.json.j2 +++ b/roles/logarr/templates/config.json.j2 @@ -24,12 +24,6 @@ "logsEnabled": "true" }, "logs": [ - { - "logTitle": "Plex_Autoscan", - "path": "\/opt\/plex_autoscan\/plex_autoscan.log", - "enabled": "Yes", - "category": "Apps" - }, { "logTitle": "CloudPlow", "path": "\/opt\/cloudplow\/cloudplow.log", diff --git a/roles/plex_autoscan/defaults/main.yml b/roles/plex_autoscan/defaults/main.yml deleted file mode 100644 index 5a846300c0..0000000000 --- a/roles/plex_autoscan/defaults/main.yml +++ /dev/null @@ -1,30 +0,0 @@ -########################################################################## -# Title: Sandbox: Plex Autoscan | Default Variables # -# Author(s): salty # -# URL: https://github.com/saltyorg/Sandbox # -# -- # -########################################################################## -# GNU General Public License v3.0 # -########################################################################## ---- -################################ -# Name -################################ - -plex_autoscan_name: plex_autoscan - -################################ -# Paths -################################ - -plex_autoscan_folder: "{{ plex_autoscan_name }}" - -plex_autoscan_path: "{{ server_appdata_path }}/{{ plex_autoscan_folder }}" - -plex_autoscan_venv_path: "{{ plex_autoscan_path }}/venv" - -plex_autoscan_python_path: "{{ plex_autoscan_bin_folder }}/python3" - -plex_autoscan_script_path: "{{ plex_autoscan_path }}/scan.py" - -plex_autoscan_alias_path: "/usr/local/bin/{{ plex_autoscan_name }}" diff --git a/roles/plex_autoscan/tasks/main.yml b/roles/plex_autoscan/tasks/main.yml deleted file mode 100644 index 5b3b7803d5..0000000000 --- a/roles/plex_autoscan/tasks/main.yml +++ /dev/null @@ -1,123 +0,0 @@ -######################################################################### -# Title: Sandbox: Plex Autoscan Role # -# Author(s): l3uddz, desimaniac # -# URL: https://github.com/saltyorg/Sandbox # -# -- # -######################################################################### -# GNU General Public License v3.0 # -######################################################################### ---- -- name: Check if Plex instance is defined - ansible.builtin.set_fact: - plex_name: "{{ plex_name | default(plex_instances[0]) }}" - -- name: Import Services Task - ansible.builtin.import_tasks: "subtasks/services.yml" - -- name: Create plex_autoscan directories - ansible.builtin.file: - path: "{{ item }}" - state: directory - owner: "{{ user.name }}" - group: "{{ user.name }}" - mode: "0775" - recurse: true - with_items: - - /opt/plex_autoscan - -- name: Clone plex_autoscan repo 'HEAD' - ansible.builtin.git: - repo: https://github.com/l3uddz/plex_autoscan.git - dest: /opt/plex_autoscan - clone: true - version: HEAD - force: true - become: true - become_user: "{{ user.name }}" - ignore_errors: true - register: plex_autoscan_clone_status - -- name: Clone plex_autoscan repo 'master' - ansible.builtin.git: - repo: https://github.com/l3uddz/plex_autoscan.git - dest: /opt/plex_autoscan - clone: true - version: master - force: true - become: true - become_user: "{{ user.name }}" - when: plex_autoscan_clone_status is failed - -- name: Set Python version - ansible.builtin.set_fact: - plex_autoscan_python: "{{ 'python3' - if ansible_distribution_version is version('20.04', '==') - else 'python3.8' }}" - -- name: "Execute Python role" - ansible.builtin.include_role: - name: "python" - vars: - python_version: "3.8" - when: ansible_distribution_version is version('22.04', '==') - -- name: Check if venv folder exists - ansible.builtin.stat: - path: "/opt/plex_autoscan/venv" - register: plex_autoscan_venv_folder - -- name: Delete venv folder - ansible.builtin.file: - path: "/opt/plex_autoscan/venv" - state: absent - when: plex_autoscan_venv_folder.stat.exists - -- name: Install pip requirements - ansible.builtin.pip: - requirements: /opt/plex_autoscan/requirements.txt - virtualenv_python: "{{ plex_autoscan_python }}" - virtualenv: "/opt/plex_autoscan/venv" - become: true - become_user: "{{ user.name }}" - -- name: Find pip3 path - ansible.builtin.find: - paths: /opt/plex_autoscan/venv - recurse: true - patterns: 'pip3' - register: files - -- name: Path - ansible.builtin.set_fact: - plex_autoscan_bin_folder: "{{ files.files[0].path | dirname }}" - -- name: Set 'scan.py' as executable - ansible.builtin.file: - path: /opt/plex_autoscan/scan.py - owner: "{{ user.name }}" - group: "{{ user.name }}" - mode: a+x - -- name: Create script alias - ansible.builtin.template: - src: plex_autoscan.sh.j2 - dest: "{{ plex_autoscan_alias_path }}" - mode: "0755" - force: true - -- name: Import 'plex_autoscan.service' - ansible.builtin.template: - src: plex_autoscan.service.j2 - dest: /etc/systemd/system/plex_autoscan.service - mode: "0644" - force: true - -- name: Import Settings Task - ansible.builtin.import_tasks: "subtasks/settings.yml" - -- name: Start 'plex_autoscan.service' - ansible.builtin.systemd_service: - name: plex_autoscan - state: started - enabled: true - daemon_reload: true diff --git a/roles/plex_autoscan/tasks/subtasks/services.yml b/roles/plex_autoscan/tasks/subtasks/services.yml deleted file mode 100644 index 878649dd2c..0000000000 --- a/roles/plex_autoscan/tasks/subtasks/services.yml +++ /dev/null @@ -1,29 +0,0 @@ -######################################################################### -# Title: Sandbox: Plex Autoscan | Services Task # -# Author(s): desimaniac # -# URL: https://github.com/saltyorg/Sandbox # -# -- # -######################################################################### -# GNU General Public License v3.0 # -######################################################################### ---- -- name: Services | Check if 'plex_autoscan.service' exists - ansible.builtin.stat: - path: "/etc/systemd/system/plex_autoscan.service" - register: plex_autoscan_service - -- name: Services | Existing 'plex_autoscan.service' Tasks - when: plex_autoscan_service.stat.exists - block: - - name: Services | Populate Service Facts - ansible.builtin.service_facts: - - - name: Services | Get 'plex_autoscan.service' state - ansible.builtin.set_fact: - plex_autoscan_service_running: "{{ (services['plex_autoscan.service'] is defined) and (services['plex_autoscan.service']['state'] == 'running') }}" - - - name: Services | Stop 'plex_autoscan.service' - ansible.builtin.systemd_service: - name: plex_autoscan - state: stopped - when: plex_autoscan_service_running diff --git a/roles/plex_autoscan/tasks/subtasks/settings.yml b/roles/plex_autoscan/tasks/subtasks/settings.yml deleted file mode 100644 index 28a1f6dac5..0000000000 --- a/roles/plex_autoscan/tasks/subtasks/settings.yml +++ /dev/null @@ -1,73 +0,0 @@ -######################################################################### -# Title: Sandbox: Plex Autoscan | Settings Task # -# Author(s): desimaniac # -# URL: https://github.com/saltyorg/Sandbox # -# -- # -######################################################################### -# GNU General Public License v3.0 # -######################################################################### ---- -- name: Settings | Install required packages - ansible.builtin.apt: - state: present - name: - - jq - - moreutils - -- name: Settings | Import Plex Auth Token role - ansible.builtin.include_role: - name: plex_auth_token - when: plex_account_is_enabled - -- name: Settings | Check if 'config.json' exists - ansible.builtin.stat: - path: "/opt/plex_autoscan/config/config.json" - register: plex_autoscan_config - -- name: Settings | New 'config.json' tasks - when: not plex_autoscan_config.stat.exists - block: - - name: Settings | Generate 32 character 'SERVER_PASS' - ansible.builtin.set_fact: - plex_autoscan_server_pass: "{{ lookup('password', '/dev/null chars=ascii_letters,digits length=32') }}" - - - name: Settings | Import default 'config.json' - ansible.builtin.template: - src: config.json.j2 - dest: /opt/plex_autoscan/config/config.json - owner: "{{ user.name }}" - group: "{{ user.name }}" - mode: "0664" - force: true - -- name: Settings | Existing 'config.json' tasks - when: plex_autoscan_config.stat.exists - block: - - name: Settings | Update 'PLEX_LD_LIBRARY_PATH' in 'config.json' - ansible.builtin.shell: | - CONFIG_PATH="/opt/plex_autoscan/config/config.json" - jq '.PLEX_LD_LIBRARY_PATH = "/usr/lib/plexmediaserver/lib"' ${CONFIG_PATH} | sponge ${CONFIG_PATH} - become: true - become_user: "{{ user.name }}" - - - name: Settings | Update Plex URL in 'config.json' - ansible.builtin.shell: | - CONFIG_PATH="/opt/plex_autoscan/config/config.json" - jq '.PLEX_LOCAL_URL = "https://plex.{{ user.domain }}"' ${CONFIG_PATH} | sponge ${CONFIG_PATH} - become: true - become_user: "{{ user.name }}" - - - name: Settings | Update Plex Token in 'config.json' - ansible.builtin.shell: | - CONFIG_PATH="/opt/plex_autoscan/config/config.json" - jq '.PLEX_TOKEN = "{{ plex_auth_token | default('') }}"' ${CONFIG_PATH} | sponge ${CONFIG_PATH} - become: true - become_user: "{{ user.name }}" - -# Update 'config.json' for new and existing setups - -- name: Settings | Upgrade 'config.json' - ansible.builtin.shell: "{{ plex_autoscan_bin_folder }}/python3 /opt/plex_autoscan/scan.py update_config" - become: true - become_user: "{{ user.name }}" - ignore_errors: true diff --git a/roles/plex_autoscan/templates/config.json.j2 b/roles/plex_autoscan/templates/config.json.j2 deleted file mode 100644 index fb482bc415..0000000000 --- a/roles/plex_autoscan/templates/config.json.j2 +++ /dev/null @@ -1,102 +0,0 @@ -{ - "DOCKER_NAME":"plex", - "GOOGLE": { - "ENABLED": false, - "CLIENT_ID": "", - "CLIENT_SECRET": "", - "ALLOWED": { - "FILE_PATHS": [ - "My Drive/Media/Movies/", - "My Drive/Media/TV/", - "My Drive/Media/Music/" - ], - "FILE_EXTENSIONS": true, - "FILE_EXTENSIONS_LIST": [ - "webm","mkv","flv","vob","ogv","ogg","drc","gif", - "gifv","mng","avi","mov","qt","wmv","yuv","rm", - "rmvb","asf","amv","mp4","m4p","m4v","mpg","mp2", - "mpeg","mpe","mpv","m2v","m4v","svi","3gp","3g2", - "mxf","roq","nsv","f4v","f4p","f4a","f4b","mp3", - "flac","ts" - ], - "MIME_TYPES": true, - "MIME_TYPES_LIST": [ - "video" - ] - }, - "TEAMDRIVE": false, - "TEAMDRIVES": [], - "POLL_INTERVAL": 120, - "SHOW_CACHE_LOGS": false - }, - "PLEX_ANALYZE_DIRECTORY": true, - "PLEX_ANALYZE_TYPE": "basic", - "PLEX_FIX_MISMATCHED": true, - "PLEX_FIX_MISMATCHED_LANG": "en", - "PLEX_DATABASE_PATH": "/opt/plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db", - "PLEX_EMPTY_TRASH": true, - "PLEX_EMPTY_TRASH_CONTROL_FILES": [ - "/mnt/unionfs/mounted.bin" - ], - "PLEX_EMPTY_TRASH_MAX_FILES": 100, - "PLEX_EMPTY_TRASH_ZERO_DELETED": false, - "PLEX_LD_LIBRARY_PATH": "/usr/lib/plexmediaserver/lib", - "PLEX_LOCAL_URL": "{{ plex_web_url }}", - "PLEX_SCANNER": "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner", - "PLEX_SUPPORT_DIR": "/var/lib/plexmediaserver/Library/Application\\ Support", - "PLEX_USER": "plex", - "PLEX_TOKEN": "{{ plex_auth_token | default('') }}", - "PLEX_CHECK_BEFORE_SCAN": true, - "PLEX_WAIT_FOR_EXTERNAL_SCANNERS": false, - "RCLONE": { - "BINARY": "/usr/bin/rclone", - "CONFIG": "/home/{{ user.name }}/.config/rclone/rclone.conf", - "CRYPT_MAPPINGS": { - }, - "RC_CACHE_REFRESH": { - "ENABLED": false, - "FILE_EXISTS_TO_REMOTE_MAPPINGS": { - "Media/": [ - "/mnt/unionfs/Media/" - ] - }, - "RC_URL": "http://localhost:5572" - } - }, - "RUN_COMMAND_BEFORE_SCAN": "", - "RUN_COMMAND_AFTER_SCAN": "", - "SERVER_ALLOW_MANUAL_SCAN": false, - "SERVER_FILE_CHECK_DELAY": 60, - "SERVER_MAX_FILE_CHECKS": 10, - "SERVER_FILE_EXIST_PATH_MAPPINGS": {}, - "SERVER_IGNORE_LIST": [ - "/.grab/", - ".DS_Store", - "Thumbs.db" - ], - "SERVER_IP": "0.0.0.0", - "SERVER_PASS": "{{ plex_autoscan_server_pass | default('') }}", - "SERVER_PATH_MAPPINGS": { - "/mnt/unionfs/Media/": [ - "/mnt/unionfs/Media/", - "My Drive/Media/" - ] - }, - "SERVER_PORT": 3468, - "SERVER_SCAN_DELAY": 180, - "SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION": true, - "SERVER_SCAN_PRIORITIES": { - "0":[ - "/TV/" - ], - "1":[ - "/Movies/" - ], - "2":[ - "/Music/" - ] - }, - "SERVER_USE_SQLITE": true, - "USE_DOCKER": true, - "USE_SUDO": false -} diff --git a/roles/plex_autoscan/templates/plex_autoscan.service.j2 b/roles/plex_autoscan/templates/plex_autoscan.service.j2 deleted file mode 100644 index 612ac2d51f..0000000000 --- a/roles/plex_autoscan/templates/plex_autoscan.service.j2 +++ /dev/null @@ -1,28 +0,0 @@ -# /etc/systemd/system/plex_autoscan.service -######################################################################### -# Title: Saltbox: Plex Autoscan Service # -# Author(s): l3uddz, desimaniac, salty # -# URL: https://github.com/saltyorg/Saltbox # -# -- # -######################################################################### -# GNU General Public License v3.0 # -######################################################################### - -[Unit] -Description=Plex Autoscan -After=network-online.target - -[Service] -User={{ user.name }} -Group={{ user.name }} -Type=simple -Environment=LC_ALL=C.UTF-8 -Environment=LANG=C.UTF-8 -Environment=FLASK_ENV=development -WorkingDirectory=/opt/plex_autoscan/ -ExecStart={{ plex_autoscan_bin_folder }}/python3 /opt/plex_autoscan/scan.py server --loglevel=INFO -Restart=always -RestartSec=10 - -[Install] -WantedBy=default.target diff --git a/roles/plex_autoscan/templates/plex_autoscan.sh.j2 b/roles/plex_autoscan/templates/plex_autoscan.sh.j2 deleted file mode 100644 index 8cfc3dc4a1..0000000000 --- a/roles/plex_autoscan/templates/plex_autoscan.sh.j2 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -(cd {{ plex_autoscan_path }} && {{ plex_autoscan_python_path }} {{ plex_autoscan_script_path }} "$@") \ No newline at end of file diff --git a/sandbox.yml b/sandbox.yml index 9b5392801f..7439118c9b 100644 --- a/sandbox.yml +++ b/sandbox.yml @@ -120,7 +120,6 @@ - { role: pgadmin, tags: ['pgadmin'] } - { role: photoprism, tags: ['photoprism'] } - { role: phpmyadmin, tags: ['phpmyadmin'] } - - { role: plex_autoscan, tags: ['plex-autoscan'] } - { role: plex_dupefinder, tags: ['plex-dupefinder'] } - { role: plex_meta_manager, tags: ['plex-meta-manager'] } - { role: plex_auto_languages, tags: ['plex-auto-languages'] }