diff --git a/README.md b/README.md index 8101312..8fc21b7 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Media Server * 4 core * 8GB RAM * NVIDIA GPU + * network storage for media * Applications * Plex @@ -20,7 +21,8 @@ Media Management (Docker) * Requirements * 4 core * 4GB RAM - * nework storage for downloads + * network storage for downloads + * network storage from media * Applications * FileBrowser @@ -28,7 +30,7 @@ Media Management (Docker) * Radarr (x2) * Prowlarr * Overseerr - * Doplarr + * Requestrr * dizquetv * Transmission? @@ -36,11 +38,14 @@ Media Management (Docker) Development Server (Docker) - Server for my code development * Requirements + * 8 cores + * 8GB RAM * Applications * VSCode Server? * Gitea * Jenkins + * Bookstack ## Home Applications @@ -66,6 +71,5 @@ Production (Docker) - Important Services * PiHole * Nginx Proxy Manager * Uptime Kuma - * Bookstack --- diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..235a98e --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,11 @@ +[defaults] + +inventory=hosts + +host_key_checking = False +deprication_warnings = False + +remote_user = ubuntu +private_key_file = ~/.ssh/id_ed25519 + +vault_password_file = ./vault-pass.sh \ No newline at end of file diff --git a/ansible/roles/base/.travis.yml b/ansible/roles/base/.travis.yml deleted file mode 100644 index 36bbf62..0000000 --- a/ansible/roles/base/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -language: python -python: "2.7" - -# Use the new container infrastructure -sudo: false - -# Install ansible -addons: - apt: - packages: - - python-pip - -install: - # Install ansible - - pip install ansible - - # Check ansible version - - ansible --version - - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg - -script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/ansible/roles/base/meta/main.yml b/ansible/roles/base/meta/main.yml index 9492dc4..d0e2a11 100644 --- a/ansible/roles/base/meta/main.yml +++ b/ansible/roles/base/meta/main.yml @@ -1,36 +1,19 @@ galaxy_info: - author: your name - description: your role description - company: your company (optional) + author: Ryan Goodwin + description: Install prereqs for docker containers - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 license: MIT min_ansible_version: "2.1" - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # # Provide a list of supported platforms, and for each platform a list of versions. # If you don't wish to enumerate all versions for a particular platform, use 'all'. # To view available platforms and versions (or releases), visit: # https://galaxy.ansible.com/api/v1/platforms/ - # platforms: - name: Ubuntu versions: - - "focal" + - focal galaxy_tags: [] # List tags for your role here, one per line. A tag is a keyword that describes diff --git a/ansible/roles/base/tasks/containers.yml b/ansible/roles/base/tasks/containers.yml index 17e691c..833d18b 100644 --- a/ansible/roles/base/tasks/containers.yml +++ b/ansible/roles/base/tasks/containers.yml @@ -1,27 +1,34 @@ --- -# Portainer (Docker container management GUI) -- name: Create Portainer volume - community.docker.docker_volume: - name: portainer-data - +# Installs Portainer or portainer agent for Docker management - name: Deploy Portainer community.docker.docker_container: name: portainer - image: docker.io/portainer/portainer-ce - ports: - - "8000:8000" - - "9443:9443" + image: portainer/portainer-ce + restart_policy: always volumes: - /var/run/docker.sock:/var/run/docker.sock - - portainer-data:/data - restart_policy: always + - portainer_data:/data + ports: + - 9000:9000 + - 8000:8000 + when: "'docker-main' in group_names" -# Watchtower (Docker container updater) +- name: Deploy Portainer Agent + community.docker.docker_container: + name: portainer-agent + image: portainer/agent + restart_policy: always + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /var/lib/docker/volumes:/var/lib/docker/volumes + when: "'docker-main' not in group_names" + +# Install Watchtower to auto update containers. Checks every 4 hours - name: Deploy Watchtower community.docker.docker_container: name: watchtower image: containrrr/watchtower - command: --schedule "0 0 4 * * *" --debug + restart_policy: always + command: --schedule "0 0 4 * * *" volumes: - /var/run/docker.sock:/var/run/docker.sock - restart_policy: always diff --git a/ansible/roles/base/tasks/main.yml b/ansible/roles/base/tasks/main.yml index b145e43..de135c9 100644 --- a/ansible/roles/base/tasks/main.yml +++ b/ansible/roles/base/tasks/main.yml @@ -4,8 +4,8 @@ apt: name: - apt-transport-https - - ca-certificates - - curl + - ca-certificates + - curl - gnupg-agent - software-properties-common update_cache: yes @@ -18,16 +18,16 @@ apt_repository: repo: deb https://download.docker.com/linux/ubuntu focal stable -- name: Install docker +- name: Install Docker apt: name: - docker-ce - docker-ce-cli - - container.io + - containerd.io update_cache: yes -- name: Add user permissions - shell: "usermod -aG docker {{ lookup('env','USER') }}" +- name: Ddd user permissions + shell: "usermod -aG docker {{ lookup ('env', 'USER') }}" # Python Docker SDK - name: Install Python package manager diff --git a/ansible/roles/media-manager/.travis.yml b/ansible/roles/media-manager/.travis.yml deleted file mode 100644 index 36bbf62..0000000 --- a/ansible/roles/media-manager/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -language: python -python: "2.7" - -# Use the new container infrastructure -sudo: false - -# Install ansible -addons: - apt: - packages: - - python-pip - -install: - # Install ansible - - pip install ansible - - # Check ansible version - - ansible --version - - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg - -script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/ansible/roles/media-manager/meta/main.yml b/ansible/roles/media-manager/meta/main.yml index c572acc..6590f66 100644 --- a/ansible/roles/media-manager/meta/main.yml +++ b/ansible/roles/media-manager/meta/main.yml @@ -1,43 +1,19 @@ galaxy_info: - author: your name - description: your role description - company: your company (optional) + author: Ryan Goodwin + description: Deploy containers to manage media collection - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker + license: MIT - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) + min_ansible_version: "2.1" - min_ansible_version: 2.1 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # # Provide a list of supported platforms, and for each platform a list of versions. # If you don't wish to enumerate all versions for a particular platform, use 'all'. # To view available platforms and versions (or releases), visit: # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 + platforms: + - name: Ubuntu + versions: + - focal galaxy_tags: [] # List tags for your role here, one per line. A tag is a keyword that describes diff --git a/ansible/roles/media-manager/tasks/main.yml b/ansible/roles/media-manager/tasks/main.yml index ee2ec63..9aff7de 100644 --- a/ansible/roles/media-manager/tasks/main.yml +++ b/ansible/roles/media-manager/tasks/main.yml @@ -1,2 +1,196 @@ --- -# tasks file for media-manager +# Docker Network +- name: Create media network + community.docker.docker_network: + name: media + +# Torrent Client +- name: Deploy Transmission + community.docker.docker_container: + name: transmission + image: haugene/transmission-openvpn + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "OPENVPN_PROVIDER: PIA" + - "OPENVPN_CONFIG: ca_toronto" + - "OPENVPN_USERNAME: {{ PIA_USER }}" + - "OPENVPN_PASSWORD: {{ PIA_PASS }}" + - "LOCAL_NETWORK: 192.168.0.0/24" + volumes: + - "{{ CONFIG_FOLDER }}/transmission/data:/data" + capabilities: + - NET_ADMIN + +# File Browser +- name: Deploy FileBrowser + community.docker.docker_container: + name: filebrowser + image: filebrowser/filebrowser + restart_policy: unless-stopped + env: + - PUID={{ PUID }} + - PGID={{ PGID }} + volumes: + - "{{ MEDIA_FOLDER }}:/srv" + - "{{ CONFIG_FOLDER }}/filebrowser/filebrowser.db:/database.db" + ports: + - 8080:80 + +# Index Handler +- name: Deploy Prowlarr + community.docker.docker_container: + name: prowlarr + image: lscr.io/linuxserver/prowlarr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + volumes: + - "{{ CONFIG_FOLDER }}/prowlarr/config:/config" + ports: + - 9696:9696 + +# TV Show Manager +- name: Deploy Sonarr + community.docker.docker_container: + name: sonarr + image: lscr.io/linuxserver/sonarr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + volumes: + - "{{ CONFIG_FOLDER }}/sonarr/config:/config" + - "{{ DOWNLOAD_FOLDER }}:/downloads" + - "{{ TV_FOLDER }}:/tv" + - "{{ TV_ANIME_FOLDER }}:/tv-anime" + ports: + - 8989:8989 + +- name: Deploy Sonarr 4k + community.docker.docker_container: + name: sonarr4k + image: lscr.io/linuxserver/sonarr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + volumes: + - "{{ CONFIG_FOLDER }}/sonarr/config:/config" + - "{{ DOWNLOAD_FOLDER }}:/downloads" + - "{{ TV_4K_FOLDER }}:/tv" + ports: + - 9898:8989 + +# Movie Manager +- name: Deploy Radarr + community.docker.docker_container: + name: radarr + image: lscr.io/linuxserver/radarr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + volumes: + - "{{ CONFIG_FOLDER }}/radarr/config:/config" + - "{{ DOWNLOAD_FOLDER }}:/downloads" + - "{{ MOVIE_FOLDER }}:/movie" + - "{{ MOVIE_ANIME_FOLDER }}:/movie-anime" + ports: + - 7878:7878 + +- name: Deploy Radarr + community.docker.docker_container: + name: radarr + image: lscr.io/linuxserver/radarr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + volumes: + - "{{ CONFIG_FOLDER }}/radarr/config:/config" + - "{{ DOWNLOAD_FOLDER }}:/downloads" + - "{{ MOVIE_FOLDER }}:/movie" + - "{{ MOVIE_ANIME_FOLDER }}:/movie-anime" + ports: + - 8787:7878 + +- name: Deploy Radarr 4k + community.docker.docker_container: + name: radarr + image: lscr.io/linuxserver/radarr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + volumes: + - "{{ CONFIG_FOLDER }}/radarr/config:/config" + - "{{ DOWNLOAD_FOLDER }}:/downloads" + - "{{ MOVIE_4k_FOLDER }}:/movie" + ports: + - 8787:7878 + +# Music Manager +- name: Deploy Lidarr + community.docker.docker_container: + name: lidarr + image: lscr.io/linuxserver/lidarr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + volumes: + - "{{ CONFIG_FOLDER }}/lidarr/config:/config" + - "{{ DOWNLOAD_FOLDER }}:/downloads" + - "{{ MUSIC_FOLDER }}:/music" + ports: + - 8686:8686 + +# Media Requests +- name: Deploy Overseerr + community.docker.docker_container: + name: overseerr + image: lscr.io/linuxserver/overseerr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + - "LOG_LEVEL=INFO" + volumes: + - "{{ CONFIG_FOLDER }}/overseerr/config:/config" + ports: + - 5055:5055 + + + +# - name: Deploy Doplarr +# community.docker.docker_container: +# name: doplarr +# image: lscr.io/linuxserver/doplarr +# restart_policy: unless-stopped +# env: +# - "TZ={{ TZ }}" +# - "PUID={{ PUID }}" +# - "PGID={{ PGID }}" +# - "DISCORD__TOKEN={{ DISCORD_TOKEN }}" +# - "OVERSEERR_API={{ OVERSEERR_API }}" + +# Custom TV Channels +- name: Deploy disquetv + community.docker.docker_container: + name: disquetv + image: vexorian/dizquetv + restart_policy: unless-stopped + volumes: + - dizquetv-data:/home/node/app/.dizquetv + ports: + - 32500:8000 diff --git a/ansible/roles/media-manager/tests/inventory b/ansible/roles/media-manager/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/ansible/roles/media-manager/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/ansible/roles/media-manager/tests/test.yml b/ansible/roles/media-manager/tests/test.yml deleted file mode 100644 index 68a5b4c..0000000 --- a/ansible/roles/media-manager/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - media-manager diff --git a/ansible/roles/media/README.md b/ansible/roles/media/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/ansible/roles/media/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/ansible/roles/media/defaults/main.yml b/ansible/roles/media/defaults/main.yml new file mode 100644 index 0000000..7a6baf8 --- /dev/null +++ b/ansible/roles/media/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for media diff --git a/ansible/roles/media/handlers/main.yml b/ansible/roles/media/handlers/main.yml new file mode 100644 index 0000000..a8a0d13 --- /dev/null +++ b/ansible/roles/media/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for media diff --git a/ansible/roles/media/meta/main.yml b/ansible/roles/media/meta/main.yml new file mode 100644 index 0000000..6220ea8 --- /dev/null +++ b/ansible/roles/media/meta/main.yml @@ -0,0 +1,28 @@ +galaxy_info: + author: Ryan Goodwin + description: Deploy container for media server + + license: MIT + + min_ansible_version: "2.1" + + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + platforms: + - name: Ubuntu + versions: + - focal + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/ansible/roles/media/tasks/main.yml b/ansible/roles/media/tasks/main.yml new file mode 100644 index 0000000..7d41cd7 --- /dev/null +++ b/ansible/roles/media/tasks/main.yml @@ -0,0 +1,10 @@ +--- +- name: Deploy Plex + community.docker.docker_container: + - name: plex + - image: lscr.io/linuxserver/plex + - restart_policy: unless-stopped + - volumes: + - "{{ CONFIG_FOLDER }}/plex/config:/config" + - "{{ MEDIA_FOLDER }}:/content" + diff --git a/ansible/roles/media/vars/main.yml b/ansible/roles/media/vars/main.yml new file mode 100644 index 0000000..2c396a6 --- /dev/null +++ b/ansible/roles/media/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for media