forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
221 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,10 @@ | |
tags: | ||
- appsmith | ||
|
||
- role: aria2 | ||
tags: | ||
- aria2 | ||
|
||
- role: authelia | ||
tags: | ||
- authelia | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
aria2_enabled: false | ||
aria2_available_externally: false | ||
|
||
# directories | ||
aria2_data_directory: "{{ docker_home }}/aria2" | ||
aria2_download_directory: "{{ downloads_root }}" | ||
|
||
# network | ||
aria2_port: "6800" | ||
aria2_listen_port: "6888" | ||
aria2_ui_port: "6880" | ||
aria2_hostname: "aria2" | ||
aria2_network_name: "aria2" | ||
|
||
# specs | ||
aria2_memory: 1g | ||
aria2_ui_memory: 1g | ||
|
||
# docker | ||
aria2_container_name: aria2 | ||
aria2_image_name: "p3terx/aria2-pro" | ||
aria2_image_version: latest | ||
aria2_ui_container_name: aria2-ui | ||
aria2_ui_image_name: "p3terx/ariang" | ||
aria2_ui_image_version: latest | ||
|
||
# aria2 | ||
aria2_user_id: "65534" | ||
aria2_group_id: "65534" | ||
aria2_umask: "022" | ||
aria2_secret: "P3TERX" | ||
aria2_disk_cache: "64M" | ||
aria2_ipv6_mode: "false" | ||
aria2_update_trackers: "true" | ||
aria2_custom_tracker_url: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# aria2 | ||
|
||
Homepage: [https://github.com/aria2/aria2](https://github.com/aria2/aria2) | ||
|
||
aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. | ||
|
||
## Usage | ||
|
||
Set `aria2_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
aria2 web interface can be found at [http://ansible_nas_host_or_ip:6880](http://ansible_nas_host_or_ip:6880). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
aria2_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Stop | ||
hosts: all | ||
become: true | ||
tasks: | ||
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role" | ||
ansible.builtin.include_role: | ||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" | ||
vars: | ||
aria2_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Get aria2 container state | ||
community.docker.docker_container: | ||
name: "{{ aria2_container_name }}" | ||
register: result | ||
|
||
- name: Get aria2 ui container state | ||
community.docker.docker_container: | ||
name: "{{ aria2_ui_container_name }}" | ||
register: result_ui | ||
|
||
- name: Check if aria2 containers are running | ||
ansible.builtin.assert: | ||
that: | ||
- result.container['State']['Status'] == "running" | ||
- result.container['State']['Restarting'] == false | ||
- result_ui.container['State']['Status'] == "running" | ||
- result_ui.container['State']['Restarting'] == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Try and stop and remove aria2 | ||
community.docker.docker_container: | ||
name: "{{ aria2_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Try and stop and remove aria2 ui | ||
community.docker.docker_container: | ||
name: "{{ aria2_ui_container_name }}" | ||
state: absent | ||
register: result_ui | ||
|
||
- name: Check if aria2 is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result.changed | ||
- not result_ui.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
- name: Start aria2 | ||
block: | ||
- name: Create aria2 Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: "{{ aria2_user_id }}" | ||
group: "{{ aria2_group_id }}" | ||
with_items: | ||
- "{{ aria2_data_directory }}" | ||
|
||
- name: Create aria2 network | ||
community.docker.docker_network: | ||
name: "{{ aria2_network_name }}" | ||
|
||
- name: Create aria2 Docker Container | ||
community.docker.docker_container: | ||
name: "{{ aria2_container_name }}" | ||
image: "{{ aria2_image_name }}:{{ aria2_image_version }}" | ||
pull: true | ||
ports: | ||
- "{{ aria2_port }}:6800" | ||
- "{{ aria2_listen_port }}:6888" | ||
volumes: | ||
- "{{ aria2_data_directory }}/config:/config" | ||
- "{{ aria2_download_directory }}:/downloads" | ||
networks: | ||
- name: "{{ aria2_network_name }}" | ||
network_mode: "{{ aria2_network_name }}" | ||
container_default_behavior: no_defaults | ||
env: | ||
PUID: "{{ aria2_user_id }}" | ||
PGID: "{{ aria2_group_id }}" | ||
UMASK_SET: "{{ aria2_umask }}" | ||
RPC_SECRET: "{{ aria2_secret }}" | ||
RPC_PORT: "{{ aria2_port }}" | ||
LISTEN_PORT: "{{ aria2_listen_port }}" | ||
DISK_CACHE: "{{ aria2_disk_cache }}" | ||
IPV6_MODE: "{{ aria2_ipv6_mode }}" | ||
UPDATE_TRACKERS: "{{ aria2_update_trackers }}" | ||
CUSTOM_TRACKER_URL: "{{ aria2_custom_tracker_url }}" | ||
TZ: "{{ ansible_nas_timezone }}" | ||
labels: | ||
traefik.enable: "false" | ||
log_driver: json-file | ||
log_options: | ||
max-size: 1m | ||
restart_policy: always | ||
memory: "{{ aria2_memory }}" | ||
|
||
- name: Create aria2 UI Docker Container | ||
community.docker.docker_container: | ||
name: "{{ aria2_ui_container_name }}" | ||
image: "{{ aria2_ui_image_name }}:{{ aria2_ui_image_version }}" | ||
pull: true | ||
ports: | ||
- "{{ aria2_ui_port }}:6880" | ||
networks: | ||
- name: "{{ aria2_network_name }}" | ||
network_mode: "{{ aria2_network_name }}" | ||
container_default_behavior: no_defaults | ||
command: --port 6880 --ipv6 | ||
labels: | ||
traefik.enable: "{{ aria2_available_externally | string }}" | ||
traefik.http.routers.aria2.rule: "Host(`{{ aria2_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.aria2.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.aria2.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.aria2.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.aria2.loadbalancer.server.port: "6880" | ||
restart_policy: always | ||
memory: "{{ aria2_ui_memory }}" | ||
when: aria2_enabled is true | ||
|
||
- name: Stop aria2 | ||
block: | ||
- name: Stop aria2 | ||
community.docker.docker_container: | ||
name: "{{ aria2_redis_container_name }}" | ||
state: absent | ||
|
||
- name: Stop aria2 ui | ||
community.docker.docker_container: | ||
name: "{{ aria2_db_container_name }}" | ||
state: absent | ||
when: aria2_enabled is false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "aria2" | ||
description: "A lightweight multi-protocol & multi-source, cross platform download utility operated in command-line" | ||
--- | ||
|
||
Homepage: [https://github.com/aria2/aria2](https://github.com/aria2/aria2) | ||
|
||
aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. | ||
|
||
## Usage | ||
|
||
Set `aria2_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
aria2 web interface can be found at [http://ansible_nas_host_or_ip:6880](http://ansible_nas_host_or_ip:6880). |