commit 554df475b33b61a1a6b55b5aa99338ab0f8a4c1c Author: root Date: Mon Jun 5 02:01:44 2023 +0200 Initial commit Committer: Davo diff --git a/README.md b/README.md new file mode 100644 index 0000000..04e2ab4 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +Ansible role for deploy node-exporter packages and services. You can add custom ports via variables bellow. + +This role is developed with Ansible 2.9.6 and tested on Ubuntu 20.04 LTS. + +## Role Variables + +| Variable | Required | Default | Comments | +| -------- | -------- | ------- | -------- | +| `additional_ports` | No | `{}` | Add aditional ports while using this role | + +## Requirements + +Ansible.posix collection + +To install it, use the following command: + +```yaml +ansible-galaxy collection install ansible.posix +``` + +## Run node-exporter role with default settings +```yaml + roles: + - sw-node-exporter +``` + +## Run node-exporter role with custom variables +```yaml + roles: + - sw-node-exporter + vars: + - additional_ports: + - 80/tcp + - 443/tcp + - 25565/udp +``` + + diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..72ad890 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +--- +additional_ports: {} diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..a896f09 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart transmission + ansible.builtin.systemd: + state: started + name: transmission-daemon diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..112e505 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,31 @@ +--- +- name: sw-transmission | 1. Add transmissionbt repository from PPA and install its signing key on Ubuntu target + ansible.builtin.apt_repository: + repo: 'ppa:transmissionbt/ppa' + codename: trusty + +- name: sw-transmission | 2. Install transmission + ansible.builtin.apt: + name: + - transmission-cli + - transmission-common + - transmission-daemon + state: present + update_cache: yes + +- name: sw-transmission | 3. Create transmission user + ansible.builtin.user: + name: transmission + group: debian-transmission + +- name: sw-transmission | 4. Stop transmission-daemon + ansible.builtin.service: + name: transmission-daemon + state: stopped + +- name: sw-transmission | 5. Copy the transmission template file and restart transmission-daemon when changed + ansible.builtin.template: + src: transmission.j2 + dest: "{{ transmission_config_location }}" + notify: + - restart transmission diff --git a/templates/transmission.j2 b/templates/transmission.j2 new file mode 100644 index 0000000..547a176 --- /dev/null +++ b/templates/transmission.j2 @@ -0,0 +1,73 @@ +{ + "alt-speed-down": 50, + "alt-speed-enabled": false, + "alt-speed-time-begin": 540, + "alt-speed-time-day": 127, + "alt-speed-time-enabled": false, + "alt-speed-time-end": 1020, + "alt-speed-up": 50, + "bind-address-ipv4": "0.0.0.0", + "bind-address-ipv6": "::", + "blocklist-enabled": false, + "blocklist-url": "http://www.example.com/blocklist", + "cache-size-mb": 4, + "dht-enabled": true, + "download-dir": "/mnt/nfs/", + "download-limit": 100, + "download-limit-enabled": 0, + "download-queue-enabled": true, + "download-queue-size": 5, + "encryption": 1, + "idle-seeding-limit": 30, + "idle-seeding-limit-enabled": false, + "incomplete-dir": "/mnt/nfs/transmission-daemon/incomplete", + "incomplete-dir-enabled": false, + "lpd-enabled": false, + "max-peers-global": 200, + "message-level": 1, + "peer-congestion-algorithm": "", + "peer-id-ttl-hours": 6, + "peer-limit-global": 200, + "peer-limit-per-torrent": 50, + "peer-port": 51413, + "peer-port-random-high": 65535, + "peer-port-random-low": 49152, + "peer-port-random-on-start": false, + "peer-socket-tos": "default", + "pex-enabled": true, + "port-forwarding-enabled": false, + "preallocation": 1, + "prefetch-enabled": true, + "queue-stalled-enabled": true, + "queue-stalled-minutes": 30, + "ratio-limit": 2, + "ratio-limit-enabled": false, + "rename-partial-files": true, + "rpc-authentication-required": false, + "rpc-bind-address": "0.0.0.0", + "rpc-enabled": true, + "rpc-host-whitelist": "", + "rpc-host-whitelist-enabled": false, + "rpc-password": "{f8725ded06b27e09c891c2e981229a192731c432yBA6cUrs", + "rpc-port": 9091, + "rpc-url": "/transmission/", + "rpc-username": "transmission", + "rpc-whitelist": "127.0.0.1,192.168.*.*", + "rpc-whitelist-enabled": true, + "scrape-paused-torrents-enabled": true, + "script-torrent-done-enabled": false, + "script-torrent-done-filename": "", + "seed-queue-enabled": false, + "seed-queue-size": 10, + "speed-limit-down": 100, + "speed-limit-down-enabled": false, + "speed-limit-up": 5, + "speed-limit-up-enabled": true, + "start-added-torrents": true, + "trash-original-torrent-files": false, + "umask": 2, + "upload-limit": 100, + "upload-limit-enabled": 0, + "upload-slots-per-torrent": 14, + "utp-enabled": true +} diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..a0419ed --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +transmission_config_location: /var/lib/transmission-daemon/info/settings.json