aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/torrents/tasks
diff options
context:
space:
mode:
authorKumar Damani <me@kumardamani.net>2025-06-30 21:11:10 +0000
committerKumar Damani <me@kumardamani.net>2025-06-30 21:11:10 +0000
commita125ec65a120ce23e4e692a48eaa169bc40e5506 (patch)
treec1c7ed19c1e00f33d5fe6d7caa3c622945b3c423 /ansible/roles/torrents/tasks
parent7e603bcc92c7ddc19dbfb0c46434bc6847ad3781 (diff)
ansible refactor to newer methods
Diffstat (limited to 'ansible/roles/torrents/tasks')
-rw-r--r--ansible/roles/torrents/tasks/config.yaml20
-rw-r--r--ansible/roles/torrents/tasks/main.yaml6
-rw-r--r--ansible/roles/torrents/tasks/setup.yaml29
3 files changed, 25 insertions, 30 deletions
diff --git a/ansible/roles/torrents/tasks/config.yaml b/ansible/roles/torrents/tasks/config.yaml
new file mode 100644
index 0000000..d375645
--- /dev/null
+++ b/ansible/roles/torrents/tasks/config.yaml
@@ -0,0 +1,20 @@
+---
+
+# We still need to stop it to place the config file or else it will get overwritten
+- name: 'config | Stop the service'
+ ansible.builtin.service:
+ name: 'transmission-daemon'
+ state: 'stopped'
+
+- name: 'config | Copy the transmission config'
+ ansible.builtin.template:
+ src: 'settings.json.j2'
+ dest: '/home/transmission-user/.config/transmission-daemon/settings.json'
+ owner: 'transmission-user'
+ mode: '644'
+
+- name: 'config | Start the service'
+ ansible.builtin.service:
+ name: 'transmission-daemon'
+ state: 'started'
+ enabled: true
diff --git a/ansible/roles/torrents/tasks/main.yaml b/ansible/roles/torrents/tasks/main.yaml
index 806a4e3..62d9b46 100644
--- a/ansible/roles/torrents/tasks/main.yaml
+++ b/ansible/roles/torrents/tasks/main.yaml
@@ -2,4 +2,8 @@
- name: 'Run the setup tasks'
ansible.builtin.import_tasks: 'setup.yaml'
- tags: 'torrents'
+ tags: ['install']
+
+- name: 'Run the config tasks'
+ ansible.builtin.import_tasks: 'config.yaml'
+ tags: ['install', 'config']
diff --git a/ansible/roles/torrents/tasks/setup.yaml b/ansible/roles/torrents/tasks/setup.yaml
index 25f1fe8..1aaaa83 100644
--- a/ansible/roles/torrents/tasks/setup.yaml
+++ b/ansible/roles/torrents/tasks/setup.yaml
@@ -1,15 +1,5 @@
---
-- name: 'setup | Ensure required vars are set'
- ansible.builtin.assert:
- that:
- - item | mandatory
- loop:
- - '{{ torrents_nas_mount_path }}'
- - '{{ torrents_rpc_username }}'
- - '{{ torrents_rpc_password }}'
- no_log: true
-
- name: 'setup | Install required pkgs'
ansible.builtin.package:
name:
@@ -58,22 +48,3 @@
ansible.builtin.service:
name: 'transmission-daemon'
state: 'started'
-
-# We still need to stop it to place the config file or else it will get overwritten
-- name: 'setup | Stop the service'
- ansible.builtin.service:
- name: 'transmission-daemon'
- state: 'stopped'
-
-- name: 'setup | Copy the transmission config'
- ansible.builtin.template:
- src: 'settings.json.j2'
- dest: '/home/transmission-user/.config/transmission-daemon/settings.json'
- owner: 'transmission-user'
- mode: '644'
-
-- name: 'setup | Start the service'
- ansible.builtin.service:
- name: 'transmission-daemon'
- state: 'started'
- enabled: true