-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.yml
112 lines (96 loc) · 3.29 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
# tasks file for chrisjohnson00.jackett
- name: Check if jackett version exists in /opt
stat:
path: "/opt/jackett/{{ chrisjohnson00_jackett_version }}"
register: jackett_install_location
- file:
path: "/opt/jackett/{{ chrisjohnson00_jackett_version }}"
state: directory
mode: 0755
when: not jackett_install_location.stat.exists
- name: "download Jackett archive file"
unarchive:
src: "https://github.com/Jackett/Jackett/releases/download/{{ chrisjohnson00_jackett_version }}/Jackett.Binaries.Mono.tar.gz"
dest: "/opt/jackett/{{ chrisjohnson00_jackett_version }}"
remote_src: True
when: not jackett_install_location.stat.exists
- name: "Add apt key for mono 5"
apt_key:
keyserver: hkp://keyserver.ubuntu.com:80
id: 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
- name: "adding repo for mono5 for ubuntu 16"
apt_repository:
repo: deb http://download.mono-project.com/repo/ubuntu xenial main
state: present
when: ansible_distribution_major_version == "16"
- name: "adding repo for mono5 for ubuntu 18"
apt_repository:
repo: deb http://download.mono-project.com/repo/ubuntu stable-bionic main
state: present
when: ansible_distribution_major_version == "18"
- name: Only run apt-get update if the last one is more than 3600 seconds ago
apt:
update_cache: yes
cache_valid_time: 3600
- name: install packages
apt:
state: present
name: "{{ item }}"
with_items: "{{ chrisjohnson00_jackett_packages }}"
- name: setup jackett user
user:
name: "{{ chrisjohnson00_jackett_user }}"
- name: check for systemd
command: systemctl --version
register: jackett_systemctl_version
ignore_errors: yes
- name: add jackett.service
template:
src: jackett.service.ini
dest: /lib/systemd/system/jackett.service
mode: 0644
become: yes
when: jackett_systemctl_version.rc == 0
notify:
- jackett_reload_systemd
- restart_jackett
- name: create configuration directory
file:
path: /home/{{ chrisjohnson00_jackett_user }}/.config/Jackett/Indexers
state: directory
mode: 0755
owner: "{{ chrisjohnson00_jackett_user }}"
group: "{{ chrisjohnson00_jackett_user }}"
- name: move indexers into place
copy:
src: "{{ chrisjohnson00_jackett_indexer_path }}"
dest: /home/{{ chrisjohnson00_jackett_user }}/.config/Jackett/Indexers
mode: 0644
owner: "{{ chrisjohnson00_jackett_user }}"
group: "{{ chrisjohnson00_jackett_user }}"
when: chrisjohnson00_jackett_load_indexers
notify:
- restart_jackett
- name: create configurations
template:
src: ServerConfig.json
dest: /home/{{ chrisjohnson00_jackett_user }}/.config/Jackett/ServerConfig-ansible.json
mode: 0644
owner: "{{ chrisjohnson00_jackett_user }}"
group: "{{ chrisjohnson00_jackett_user }}"
become: yes
- name: move new config into place
copy:
src: /home/{{ chrisjohnson00_jackett_user }}/.config/Jackett/ServerConfig-ansible.json
dest: /home/{{ chrisjohnson00_jackett_user }}/.config/Jackett/ServerConfig.json
remote_src: yes
mode: 0644
owner: "{{ chrisjohnson00_jackett_user }}"
group: "{{ chrisjohnson00_jackett_user }}"
notify:
- restart_jackett
- name: remove temp file
file:
path: /home/{{ chrisjohnson00_jackett_user }}/.config/Jackett/ServerConfig-ansible.json
state: absent