--- - name: 'setup | Ensure required vars are set' ansible.builtin.assert: that: - item | mandatory loop: - '{{ plex_nas_mount_path }}' no_log: true - name: 'setup | Install required pkgs' ansible.builtin.package: name: - 'nfs-common' - 'curl' - 'gnupg' - name: 'setup | Create the mount dir' ansible.builtin.file: path: '/mnt/data' state: 'directory' mode: '755' - name: 'setup | Setup the NFS mount' ansible.posix.mount: src: '{{ plex_nas_mount_path }}' path: '/mnt/data' state: 'mounted' fstype: 'nfs' - name: 'setup | Get the Plex signed keys' ansible.builtin.shell: # noqa: risky-shell-pipe command-instead-of-module cmd: > curl -sS https://downloads.plex.tv/plex-keys/PlexSign.key | gpg --dearmor | tee /usr/share/keyrings/plex.gpg > /dev/null creates: '/usr/share/keyrings/plex.gpg' - name: 'setup | Set the Plex sources' ansible.builtin.copy: dest: '/etc/apt/sources.list.d/plexmediaserver.list' content: | deb [signed-by=/usr/share/keyrings/plex.gpg] https://downloads.plex.tv/repo/deb public main mode: '644' - name: 'setup | Install the package' ansible.builtin.apt: name: 'plexmediaserver' state: 'present' update_cache: true - name: 'setup | Start the service' ansible.builtin.service: name: 'plexmediaserver' state: 'stopped' enabled: true