-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
main.yml
43 lines (38 loc) · 1.63 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
#######################################################################
# Title: Sandbox: PlexTraktSync | Tasks | Pre-Install #
# Author(s): keldian #
# URL: https://github.com/saltyorg/Sandbox #
# -- #
#######################################################################
# GNU General Public License v3.0 #
#######################################################################
---
- name: Set default Plex instance
ansible.builtin.set_fact:
plex_name: "{{ plex_name | default(plex_instances[0]) }}"
- name: Check if {{ plex_paths_config_location | basename }} exists
ansible.builtin.stat:
path: "{{ plex_paths_config_location }}"
register: preferences_xml
- name: Get default Plex username
ignore_errors: true
when: preferences_xml.stat.exists
block:
- name: Get {{ plex_paths_config_location | basename }} XML data
community.general.xml:
path: "{{ plex_paths_config_location }}"
xpath: /Preferences
content: attribute
register: preferences_xml_resp
- name: Set plex_owner_username variable
ansible.builtin.set_fact:
plex_owner_username: "{{ preferences_xml_resp.matches[0].Preferences.PlexOnlineUsername }}"
- name: Plex Auth Token tasks
ansible.builtin.include_role:
name: plex_auth_token
when: plex_account_is_enabled
- name: Create {{ plextraktsync_paths_env | basename }}
ansible.builtin.template:
src: env.j2
dest: "{{ plextraktsync_paths_env }}"
mode: 0644