style: make ansible-lint happier

This commit is contained in:
VC
2024-07-05 11:53:33 +02:00
parent 332dc0f60a
commit 2728bc28cd
27 changed files with 125 additions and 87 deletions

View File

@@ -1,14 +1,16 @@
---
- name: reload transmission
service:
- name: Reload transmission
ansible.builtin.service:
name: transmission-daemon
state: reloaded
- name: restart sonarr
service:
- name: Restart sonarr
ansible.builtin.service:
name: sonarr
state: restarted
- name: export nfs
command: exportfs -a
- name: Export nfs
ansible.builtin.command:
cmd: exportfs -a
changed_when: true

View File

@@ -1,14 +1,14 @@
---
- name: create Series folder
file:
- name: Create Series folder
ansible.builtin.file:
path: /var/lib/transmission-daemon/downloads/Series
recurse: true
owner: debian-transmission
group: debian-transmission
- name: create Movies folder
file:
- name: Create Movies folder
ansible.builtin.file:
path: /var/lib/transmission-daemon/downloads/Movies
recurse: true
owner: debian-transmission

View File

@@ -1,7 +1,12 @@
---
- include_tasks: transmission.yml
- include_tasks: sonarr.yml
- include_tasks: subliminal.yml
- include_tasks: configdir.yml
- include_tasks: nfsserver.yml
- name: Include transmission
ansible.builtin.include_tasks: transmission.yml
- name: Include sonarr
ansible.builtin.include_tasks: sonarr.yml
- name: Include subliminal
ansible.builtin.include_tasks: subliminal.yml
- name: Include configdir
ansible.builtin.include_tasks: configdir.yml
- name: Include nfsserver
ansible.builtin.include_tasks: nfsserver.yml

View File

@@ -1,17 +1,19 @@
---
- getent:
- name: Get debian-transmission id
ansible.builtin.getent:
database: passwd
key: debian-transmission
- name: install nfs server
package:
- name: Install nfs server
ansible.builtin.package:
name: nfs-kernel-server
state: present
- name: copy exports file
template:
- name: Copy exports file
ansible.builtin.template:
src: exports.j2
dest: /etc/exports
mode: 0644
notify:
- export nfs
- Export nfs

View File

@@ -1,29 +1,29 @@
---
- name: install sonarr repokey
apt_key:
- name: Install sonarr repokey
ansible.builtin.apt_key:
keyserver: keyserver.ubuntu.com
id: "0xa236c58f409091a18aca53cbebff6b99d9b78493"
- name: install sonarr repo
apt_repository:
- name: Install sonarr repo
ansible.builtin.apt_repository:
repo: deb http://apt.sonarr.tv/debian buster-develop main
state: present
- name: create sonarr conf dir
file:
- name: Create sonarr conf dir
ansible.builtin.file:
path: /var/lib/transmission-daemon/.config/NzbDrone
recurse: true
owner: debian-transmission
group: debian-transmission
mode: "a-rwx,u+rwX,g+rX"
- name: install sonarr
package:
- name: Install sonarr
ansible.builtin.package:
name: sonarr
state: present
- name: enable sonarr service
service:
- name: Enable sonarr service
ansible.builtin.service:
name: sonarr
enabled: true

View File

@@ -1,17 +1,17 @@
---
- name: install pip3
package:
- name: Install pip3
ansible.builtin.package:
name: python3-pip
state: present
- name: install subliminal
pip:
- name: Install subliminal
ansible.builtin.pip:
name: subliminal
state: present
- name: install subliminal crontab
cron:
- name: Install subliminal crontab
ansible.builtin.cron:
name: "Sub DL"
user: "debian-transmission"
minute: "15"

View File

@@ -1,25 +1,25 @@
---
- name: install transmission
package:
- name: Install transmission
ansible.builtin.package:
name: "{{ item }}"
state: present
loop:
- transmission-daemon
- transmission-cli
- name: transmission config file
template:
- name: Transmission config file
ansible.builtin.template:
src: settings.json.j2
dest: /etc/transmission-daemon/settings.json
owner: debian-transmission
group: debian-transmission
mode: "a-rwx,u+rw"
notify:
- reload transmission
- Reload transmission
- name: Add cachedir file
copy:
ansible.builtin.copy:
src: files/CACHEDIR.TAG
dest: /var/lib/transmission-daemon/downloads/CACHEDIR.TAG
owner: debian-transmission

View File

@@ -1,28 +1,30 @@
---
- name: create SSH key
openssh_keypair:
- name: Create SSH key
community.crypto.openssh_keypair:
path: ~/.ssh/id_rsa
- name: get SSH pub key
command: cat ~/.ssh/id_rsa.pub
- name: Get SSH pub key
ansible.builtin.command:
cmd: cat ~/.ssh/id_rsa.pub
changed_when: true
register: ssh_keys
- name: put backup script
template:
- name: Put backup script
ansible.builtin.template:
src: borgbackup.sh.j2
dest: /usr/local/bin/borgbackup.sh
owner: root
group: root
mode: '0750'
- name: cron the backup script
cron:
- name: Cron the backup script
ansible.builtin.cron:
name: "borg backup script"
hour: "{{ borg_backup_hour }}"
minute: "{{ borg_backup_minute }}"
job: /usr/local/bin/borgbackup.sh
- name: warns about borg init
debug:
- name: Warns about borg init
ansible.builtin.debug:
msg: "Borg has been installed. Dont forget to init with: \nborg init --encryption=repokey-blake2 backup@{{ hostvars[groups['borg_server'][0]]['ansible_fqdn'] }}:home"

View File

@@ -1,15 +1,15 @@
---
- name: mount backup disk
mount:
- name: Mount backup disk
ansible.posix.mount:
path: /backup
src: LABEL=BACKUP
fstype: ext4
opts: noatime,nofail
state: mounted
- name: create backup user
user:
- name: Create backup user
ansible.builtin.user:
name: backup
comment: Backup
create_home: true
@@ -18,8 +18,8 @@
system: true
state: present
- name: "create directory for borg clients"
file:
- name: Create directory for borg clients
ansible.builtin.file:
path: "/backup/repos/{{ hostvars[item]['ansible_fqdn'] }}"
state: directory
mode: '0750'
@@ -27,8 +27,8 @@
group: backup
loop: "{{ groups['borg_client'] }}"
- name: "set authorized_keys for borg clients"
authorized_key:
- name: Set authorized_keys for borg clients
ansible.posix.authorized_key:
user: backup
key: "{{ hostvars[item]['ssh_keys']['stdout'] }}"
key_options: "command=\"cd /backup/repos/{{ hostvars[item]['ansible_fqdn'] }}; borg serve --restrict-to-path /backup/repos/{{ hostvars[item]['ansible_fqdn'] }}\""

View File

@@ -1,12 +1,16 @@
---
- set_fact:
- name: Set borg fact
ansible.builtin.set_fact:
borgbackup: borg
when: ansible_facts['distribution'] == "Archlinux"
- set_fact:
- name: Set borgbackup fact
ansible.builtin.set_fact:
borgbackup: borgbackup
when: ansible_facts['distribution'] == "Debian"
- name: install borg package
package:
- name: Install borg package
ansible.builtin.package:
name: "{{ borgbackup }}"
state: present