Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Oct 26, 2019
1 parent 9ef25b7 commit 39218fe
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions menu/roles/plex_auth_token/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
---
- name: Set plex.user fact | username
shell: cat /var/plexguide/plex.user
register: plex.user
register: plexus

- name: Set plex.user fact | passwort
shell: cat /var/plexguide/plex.pw
register: plex.pass
register: plexpw

- name: "Get X-Plex-Token"
uri:
url: https://plex.tv/users/sign_in.json
Expand All @@ -25,19 +25,16 @@
X-Plex-Product: "{{ plex_auth_token_product }}"
X-Plex-Client-Identifier: "{{ plex_auth_token_client_identifier }}"
Content-Type: "application/x-www-form-urlencoded; charset=utf-8"
user: '{{ plex.user }}'
password: '{{ plex.pass }}'
user: '{{ plexus }}'
password: '{{ plexpw }}'
status_code: 201
register: plex_token_raw

- name: Display 'Plex Pass' status
debug:
msg: "Plex Pass is {{ ('plexpass' in plex_token_raw.json.user.roles.roles) | ternary('enabled','disabled') }}."

- name: Set plex_auth_token variable
set_fact:
plex_auth_token: "{{ plex_token_raw.json.user.authToken | regex_replace('\n', '') }}"

- name: Display Plex Auth Token
debug:
msg: "Plex Auth Token: {{ plex_auth_token }}"

0 comments on commit 39218fe

Please sign in to comment.