Skip to content

Commit

Permalink
plex: move post install tasks to plex_extra_tasks
Browse files Browse the repository at this point in the history
disable remote access
  • Loading branch information
saltydk committed Sep 18, 2023
1 parent a3c4cbe commit 05ed101
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 72 deletions.
3 changes: 0 additions & 3 deletions roles/plex/tasks/main2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@
- name: Create Docker container
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml"

- name: Post-Install Tasks
ansible.builtin.import_tasks: "subtasks/post-install/main.yml"

- name: "Execute Plex Extra Tasks role"
ansible.builtin.include_role:
name: "plex_extra_tasks"
Expand Down
20 changes: 0 additions & 20 deletions roles/plex/tasks/subtasks/post-install/main.yml

This file was deleted.

47 changes: 0 additions & 47 deletions roles/plex/tasks/subtasks/post-install/update_ports.yml

This file was deleted.

4 changes: 2 additions & 2 deletions roles/plex_extra_tasks/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
#########################################################################
---
plex_extra_tasks_hostname: "{{ plex_name
if not ('container:' in lookup('vars', 'plex_docker_network_mode', default=docker_networks_name_common))
else (lookup('vars', 'plex_docker_network_mode', default=docker_networks_name_common).split(':')[1]) }}"
if not ('container:' in lookup('vars', plex_name + '_docker_network_mode_default', default=docker_networks_name_common))
else (lookup('vars', plex_name + '_docker_network_mode_default', default=docker_networks_name_common).split(':')[1]) }}"
49 changes: 49 additions & 0 deletions roles/plex_extra_tasks/tasks/main2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,55 @@
vars:
var_prefix: "plex"

- name: Ensure transcodes folder has the correct permissions
ansible.builtin.file:
path: "{{ plex_paths_transcodes_location }}"
owner: "{{ user.name }}"
group: "{{ user.name }}"
mode: "0775"
recurse: true

- name: Find external port binding for '{{ plex_docker_container }}' docker port '{{ plex_web_port }}'
when: plex_open_main_ports
block:
- name: Lookup host port mapped to '{{ plex_docker_container }}' docker port '{{ plex_web_port }}'
ansible.builtin.shell: docker port {{ plex_docker_container }} {{ plex_web_port }} 2> /dev/null | sed 's/[0-9.]*://'
register: plex_docker_port_lookup_cmd
changed_when: false

- name: Set port variable
ansible.builtin.set_fact:
plex_docker_port_lookup: "{{ (plex_docker_port_lookup_cmd.stdout | trim)
if (plex_docker_port_lookup_cmd.stdout | trim | length > 0)
else plex_web_port }}"

- name: Update port in '{{ plex_paths_config_location | basename }}'
community.general.xml:
path: "{{ plex_paths_config_location }}"
xpath: /Preferences
attribute: ManualPortMappingPort
value: "{{ plex_docker_port_lookup | default(plex_web_port) }}"
state: present
become: true
become_user: "{{ user.name }}"

- name: Disable Remote Access in '{{ plex_paths_config_location | basename }}'
community.general.xml:
path: "{{ plex_paths_config_location }}"
xpath: /Preferences
attribute: PublishServerOnPlexOnlineKey
value: "0"
state: present
become: true
become_user: "{{ user.name }}"

- name: Reset permissions of '{{ plex_paths_config_location | basename }}'
ansible.builtin.file:
path: "{{ plex_paths_config_location }}"
owner: "{{ user.name }}"
group: "{{ user.name }}"
mode: "0644"

- name: "Install Sub-Zero Plugin"
ansible.builtin.include_role:
name: sub_zero
Expand Down

0 comments on commit 05ed101

Please sign in to comment.