Skip to content

Commit

Permalink
settings: add feeder mount if it was enabled previously
Browse files Browse the repository at this point in the history
  • Loading branch information
saltydk committed Sep 27, 2023
1 parent 72874c5 commit e561187
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
((downloads.nzbs is undefined)
or
(downloads.torrents is undefined)) }}"
old_feeder_mount: "{{ not ((mounts.feeder is undefined)
or
(mounts.feeder is none)
or
(mounts.feeder | trim | length == 0)) }}"

- name: Migrator | 'settings.yml' | Migration 01 | Rebuild 'downloads' dict
ansible.builtin.shell: |
Expand Down Expand Up @@ -44,14 +49,21 @@
become_user: "{{ saltbox_yml.stat.pw_name }}"
when: (rclone.remotes is undefined) and not rclone_old_remote_is_defined

- name: Migrator | 'settings.yml' | Migration 01 | Add feeder to remotes
ansible.builtin.shell: |
yyq e -i '.rclone.remotes += [{"remote": "feeder", "template": "sftp", "upload": false, "upload_from": "/mnt/local/Media", "vfs_cache": {"enabled": false, "size": "50G", "max_age": "504h"}}]' {{ playbook_dir }}/{{ file }}
become: true
become_user: "{{ saltbox_yml.stat.pw_name }}"
when: old_feeder_mount

- name: Migrator | 'settings.yml' | Migration 01 | Create 'rclone.enabled' dict
ansible.builtin.shell: |
yyq e -i '.rclone.enabled = {{ "true" if (rclone_old_remote_is_defined or rclone_remote_is_defined) else "false" }}' {{ playbook_dir }}/{{ file }}
become: true
become_user: "{{ saltbox_yml.stat.pw_name }}"
when: (rclone.enabled is undefined)

- name: Migrator | 'adv_settings.yml' | Migration 01 | Remove 'null' values
- name: Migrator | 'settings.yml' | Migration 01 | Remove 'null' values
ansible.builtin.replace:
path: "{{ playbook_dir }}/{{ file }}"
regexp: '(?<=: )\bnull\s*$'
Expand All @@ -60,5 +72,5 @@
group: "{{ saltbox_yml.stat.gid }}"
mode: "0664"

- name: Migrator | 'adv_settings.yml' | Migration 01 | Re-import Variables
- name: Migrator | 'settings.yml' | Migration 01 | Re-import Variables
ansible.builtin.include_vars: "{{ playbook_dir }}/{{ file }}"

0 comments on commit e561187

Please sign in to comment.