Skip to content

Commit

Permalink
11
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Aug 26, 2019
1 parent 2e5de9f commit a6990b7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions menu/roles/traktarr/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
when: traktarr_service.stat.exists

- name: Create traktarr directories
file: 'path={{item}} state=directory mode=0775 owner=1000 group=1000 recurse=yes'
file: "path={{ item }} state=directory mode=0775 owner={{ user.name }} group={{ user.name }} recurse=yes"
with_items:
- /opt/traktarr

Expand All @@ -28,6 +28,8 @@
dest: /opt/traktarr
version: HEAD
force: yes
become: yes
become_user: "{{ user.name }}"

- name: Install pip requirements
pip:
Expand All @@ -41,7 +43,7 @@

- name: "Check if sonarr exists"
stat:
path: "/opt/appdata/sonarr/app/config.xml"
path: "/opt/sonarr/app/config.xml"
register: sonarr_config
when: not traktarr_config.stat.exists

Expand All @@ -50,7 +52,7 @@

- name: Pull sonarr api key
xml:
path: "/opt/appdata/sonarr/app/config.xml"
path: "/opt/sonarr/app/config.xml"
xpath: /Config/ApiKey
content: text
register: xmlresp
Expand All @@ -63,7 +65,7 @@

- name: "Check if radarr exists"
stat:
path: "/opt/appdata/radarr/app/config.xml"
path: "/opt/radarr/app/config.xml"
register: radarr_config
when: not traktarr_config.stat.exists

Expand All @@ -72,7 +74,7 @@

- name: Pull radarr api key
xml:
path: "/opt/appdata/radarr/app/config.xml"
path: "/opt/radarr/app/config.xml"
xpath: /Config/ApiKey
content: text
register: xmlresp
Expand All @@ -87,20 +89,21 @@
template:
src: config.json.j2
dest: /opt/traktarr/config.json
user: 1000:1000
owner: "{{ user.name }}"
group: "{{ user.name }}"
mode: 0775
force: yes
when: not traktarr_config.stat.exists

- name: Set traktarr.py as executable
file:
path: /opt/traktarr/traktarr.py
owner: '1000'
group: '1000'
owner: "{{ user.name }}"
group: "{{ user.name }}"
mode: a+x

- name: Set directory permissions
file: "path=/opt/traktarr state=directory mode=0775 owner=1000 group=1000 recurse=yes"
file: "path=/opt/traktarr state=directory owner={{ user.name }} group={{ user.name }} recurse=yes"

- name: "Create /usr/local/bin symlink"
file:
Expand All @@ -120,4 +123,4 @@
name: traktarr
state: "{{ traktarr_config.stat.exists | ternary('started','stopped') }}"
enabled: "{{ traktarr_config.stat.exists | ternary('yes','no') }}"
daemon_reload: yes
daemon_reload: yes

0 comments on commit a6990b7

Please sign in to comment.