aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/README.md29
-rw-r--r--ansible/playbooks/init.yaml47
-rw-r--r--ansible/roles/caddy_add/meta/argument_specs.yaml26
-rw-r--r--ansible/roles/caddy_add/meta/main.yaml3
-rw-r--r--ansible/roles/caddy_add/tasks/main.yaml9
-rw-r--r--ansible/roles/med_dl/defaults/main.yaml3
-rw-r--r--ansible/roles/med_dl/meta/argument_specs.yaml16
-rw-r--r--ansible/roles/med_dl/meta/main.yaml5
-rw-r--r--ansible/roles/med_dl/tasks/config.yaml12
-rw-r--r--ansible/roles/med_dl/tasks/main.yaml5
-rw-r--r--ansible/roles/med_dl/tasks/setup.yaml19
-rw-r--r--ansible/roles/monitoring/meta/argument_specs.yaml10
-rw-r--r--ansible/roles/monitoring/meta/main.yaml4
-rw-r--r--ansible/roles/monitoring/tasks/config.yaml13
-rw-r--r--ansible/roles/monitoring/tasks/main.yaml6
-rw-r--r--ansible/roles/monitoring/tasks/setup.yaml12
-rw-r--r--ansible/roles/nextcloud/defaults/main.yaml10
-rw-r--r--ansible/roles/nextcloud/meta/argument_specs.yaml25
-rw-r--r--ansible/roles/nextcloud/meta/main.yaml5
-rw-r--r--ansible/roles/nextcloud/tasks/config.yaml12
-rw-r--r--ansible/roles/nextcloud/tasks/main.yaml6
-rw-r--r--ansible/roles/nextcloud/tasks/setup.yaml21
-rw-r--r--ansible/roles/plex/defaults/main.yaml3
-rw-r--r--ansible/roles/plex/meta/argument_specs.yaml15
-rw-r--r--ansible/roles/plex/meta/main.yaml4
-rw-r--r--ansible/roles/plex/tasks/main.yaml2
-rw-r--r--ansible/roles/torrents/defaults/main.yaml5
-rw-r--r--ansible/roles/torrents/meta/argument_specs.yaml25
-rw-r--r--ansible/roles/torrents/meta/main.yaml4
-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
-rw-r--r--ansible/roles/vault/meta/argument_specs.yaml10
-rw-r--r--ansible/roles/vault/meta/main.yaml5
-rw-r--r--ansible/roles/vault/tasks/main.yaml2
35 files changed, 276 insertions, 152 deletions
diff --git a/ansible/README.md b/ansible/README.md
index f693916..4c67f24 100644
--- a/ansible/README.md
+++ b/ansible/README.md
@@ -37,26 +37,26 @@ git checkout group_vars/all/vault.example
```
1. View/edit your encrypted vault:
```bash
-ansible-vault view/edit --vault-id vaultkey group_vars/all/vault
+ansible-vault view/edit group_vars/all/vault
```
-1. (FTO) Run the `init.yaml` playbook to install a service
+1. (FTO) Run the `init.yaml` playbook with a `limit` to install a service
```bash
-ansible-playbook -u youruser -i hosts --vault-id vaultkey playbooks/init.yaml --tags=[app name]
+ansible-playbook playbooks/init.yaml --limit=[app name] --tags=install
```
-1. Use another playbook to modify a service (not yet implemented but planned)
+1. Use another playbook to modify a service
```bash
-ansible-playbook -u youruser -i hosts --vault-id vaultkey playbooks/... --tags=[...]
+ansible-playbook playbooks/... --limit=[app name] --tags=config
```
# Ansible Roles
You can think of each Role being an "app".
Each Role has a `setup.yaml` task file responsible for installing the app.
-It may or may not have other task files depending on what other functionality this Role
-supports for this app.
+It may or may not have other task files (eg. `config.yaml`) depending on what other
+functionality this Role supports for this app.
The `main.yaml` file in the Role determines the flow logic for which task files
-are getting run based on Tags for other functionalities (see Tags section below).
+are getting run based on Tags.
# Artifacts
@@ -67,16 +67,3 @@ but it also allows us to use some of this info in other parts of Ansible for cle
> Never commit this dir to git. It contains sensitive info! Its already configured to
be ignored by git.
-
-
-# Ansible Tags
-Setting up the app is normally done using the Role's name as the tag,
-i.e. `--tags <role name>`.
-
-Any subsequent tasks required beyond setting up the app, will have a different
-tag associated for those tasks (along with a different playbook to trigger them).
-For example, the MinIO Role will support adding a new user+bucket under the tag `add_minio_user`:
-
-```bash
-ansible-playbook ... playbooks/add_user.yaml --tags add_minio_user
-```
diff --git a/ansible/playbooks/init.yaml b/ansible/playbooks/init.yaml
index 0b8d58e..0b22716 100644
--- a/ansible/playbooks/init.yaml
+++ b/ansible/playbooks/init.yaml
@@ -1,13 +1,15 @@
---
-# ansible-playbook -u root -i 'hosts' --vault-id vaultkey playbooks/init.yaml --tags=vault
- name: 'Deploy Vault'
hosts: 'vault'
- tags: ["never", "vault"]
gather_facts: false
+ pre_tasks: &pretasks_common
+ - name: 'Check that limit is set'
+ fail:
+ msg: 'Must apply limit on hosts'
+ when: 'ansible_limit is not defined'
+ tags: ["always"]
roles:
- - role: 'base'
- - role: 'docker'
- role: 'vault'
- role: 'caddy_add'
vars:
@@ -15,34 +17,23 @@
caddy_add_upstream_host: '{{ inventory_hostname }}'
caddy_add_upstream_port: 8989
-# ansible-playbook -u root -i 'hosts' --vault-id vaultkey playbooks/init.yaml --tags=torrents
- name: 'Deploy Transmission'
hosts: 'torrents'
- tags: ["never", "torrents"]
gather_facts: false
+ pre_tasks: *pretasks_common
roles:
- - role: 'base'
- role: 'torrents'
- vars:
- torrents_nas_mount_path: '{{ vaultvar_torrents_nas_nfs_path }}'
- torrents_rpc_username: '{{ vaultvar_torrents_rpc_username }}'
- torrents_rpc_password: '{{ vaultvar_torrents_rpc_password }}'
- role: 'caddy_add'
vars:
caddy_add_hosts: ['{{ vaultvar_torrents_cname }}.{{ vaultvar_root_domain }}']
caddy_add_upstream_host: '{{ inventory_hostname }}'
-# ansible-playbook -u root -i 'hosts' --vault-id vaultkey playbooks/init.yaml --tags=med_dl
- name: 'Deploy Media Downloaders'
hosts: 'med-dl'
- tags: ["never", "med_dl"]
gather_facts: false
+ pre_tasks: *pretasks_common
roles:
- - role: 'base'
- - role: 'docker'
- role: 'med_dl'
- vars:
- med_dl_nas_mount_path: '{{ vaultvar_med_dl_nas_nfs_path }}'
- role: 'caddy_add'
vars:
caddy_add_hosts: ['{{ vaultvar_sonarr_cname }}.{{ vaultvar_root_domain }}']
@@ -59,48 +50,32 @@
caddy_add_upstream_host: '{{ inventory_hostname }}'
caddy_add_upstream_port: 8686
-# ansible-playbook -u root -i 'hosts' --vault-id vaultkey playbooks/init.yaml --tags=nextcloud
- name: 'Deploy Nextcloud'
hosts: 'nc'
- tags: ["never", "nc"]
gather_facts: false
+ pre_tasks: *pretasks_common
roles:
- - role: 'base'
- - role: 'docker'
- role: 'nextcloud'
- vars:
- nextcloud_nas_mount_path: '{{ vaultvar_nextcloud_nas_nfs_path }}'
- nextcloud_php_max_mem_mb: 8000
- nextcloud_php_max_upload_size_gb: 10
- # You should have DRI devices showing up in your container in `/dev/dri/`.
- # See the TF readme for steps to enable this.
- # If not, then set this to false here.
- # Leave this as a yaml string, it is going to used as a shell var.
- nextcloud_enable_dri: 'true'
- role: 'caddy_add'
vars:
caddy_add_hosts: ['{{ vaultvar_nextcloud_cname }}.{{ vaultvar_root_domain }}']
caddy_add_upstream_host: '{{ inventory_hostname }}'
caddy_add_upstream_port: 11000
-# ansible-playbook -u root -i 'hosts' --vault-id vaultkey playbooks/init.yaml --tags=plex
- name: 'Deploy Plex'
hosts: 'plex'
- tags: ["never", "plex"]
gather_facts: false
+ pre_tasks: *pretasks_common
roles:
- - role: 'base'
- role: 'plex'
vars:
plex_nas_mount_path: '{{ vaultvar_plex_nas_nfs_path }}'
-# ansible-playbook -u root -i 'hosts' --vault-id vaultkey playbooks/init.yaml --tags=monitoring
- name: 'Deploy Prometheus'
hosts: 'monitoring'
- tags: ["never", "monitoring"]
gather_facts: false
+ pre_tasks: *pretasks_common
roles:
- - role: 'base'
- role: 'monitoring'
- role: 'caddy_add'
vars:
diff --git a/ansible/roles/caddy_add/meta/argument_specs.yaml b/ansible/roles/caddy_add/meta/argument_specs.yaml
new file mode 100644
index 0000000..3c40bd6
--- /dev/null
+++ b/ansible/roles/caddy_add/meta/argument_specs.yaml
@@ -0,0 +1,26 @@
+---
+
+argument_specs:
+ main:
+ short_description: Main entry point for the Caddy add role
+ description:
+ - This role updates our Caddy RProxy via it's API with a new route.
+ author:
+ - Kumar Damani
+ options:
+ caddy_add_hosts:
+ type: 'list'
+ elements: 'str'
+ required: true
+ description:
+ - The desired fqdn for the service to add.
+ caddy_add_upstream_host:
+ type: 'str'
+ required: true
+ description:
+ - The hostname of the host hosting this service.
+ caddy_add_upstream_port:
+ type: 'int'
+ required: true
+ description:
+ - The port of the service on the host.
diff --git a/ansible/roles/caddy_add/meta/main.yaml b/ansible/roles/caddy_add/meta/main.yaml
new file mode 100644
index 0000000..0f50759
--- /dev/null
+++ b/ansible/roles/caddy_add/meta/main.yaml
@@ -0,0 +1,3 @@
+---
+
+dependencies: []
diff --git a/ansible/roles/caddy_add/tasks/main.yaml b/ansible/roles/caddy_add/tasks/main.yaml
index 4dcbd8a..8177f6a 100644
--- a/ansible/roles/caddy_add/tasks/main.yaml
+++ b/ansible/roles/caddy_add/tasks/main.yaml
@@ -1,14 +1,5 @@
---
-- name: 'Ensure required vars are set'
- ansible.builtin.assert:
- that:
- - item | mandatory
- loop:
- - '{{ caddy_add_hosts }}'
- - '{{ caddy_add_upstream_host }}'
- - '{{ caddy_add_upstream_port }}'
-
- name: 'Call the Caddy API to add our new host'
ansible.builtin.uri:
url: 'http://rproxy:2019/config/apps/http/servers/srv0/routes/0'
diff --git a/ansible/roles/med_dl/defaults/main.yaml b/ansible/roles/med_dl/defaults/main.yaml
new file mode 100644
index 0000000..4e58323
--- /dev/null
+++ b/ansible/roles/med_dl/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+
+med_dl_nas_mount_path: '{{ vaultvar_med_dl_nas_nfs_path }}'
diff --git a/ansible/roles/med_dl/meta/argument_specs.yaml b/ansible/roles/med_dl/meta/argument_specs.yaml
new file mode 100644
index 0000000..6718b94
--- /dev/null
+++ b/ansible/roles/med_dl/meta/argument_specs.yaml
@@ -0,0 +1,16 @@
+---
+
+argument_specs:
+ main:
+ short_description: Main entry point for the Media Downloader role
+ description:
+ - This role installs the *arr apps as a Docker Compose project.
+ - We install Prowlarr, Sonarr, Radarr, Lidarr.
+ author:
+ - Kumar Damani
+ options:
+ med_dl_nas_mount_path:
+ type: 'str'
+ required: true
+ description:
+ - The path to the data on the NFS share.
diff --git a/ansible/roles/med_dl/meta/main.yaml b/ansible/roles/med_dl/meta/main.yaml
new file mode 100644
index 0000000..bd4979e
--- /dev/null
+++ b/ansible/roles/med_dl/meta/main.yaml
@@ -0,0 +1,5 @@
+---
+
+dependencies:
+ - role: 'base'
+ - role: 'docker'
diff --git a/ansible/roles/med_dl/tasks/config.yaml b/ansible/roles/med_dl/tasks/config.yaml
new file mode 100644
index 0000000..367e7d5
--- /dev/null
+++ b/ansible/roles/med_dl/tasks/config.yaml
@@ -0,0 +1,12 @@
+---
+
+- name: 'config | Copy the docker-compose file'
+ ansible.builtin.template:
+ src: 'docker-compose.yaml.j2'
+ dest: 'docker-compose.yaml'
+ mode: '644'
+
+- name: 'config | Start the service'
+ ansible.builtin.command: 'docker-compose up -d'
+ register: '_compose_up_cmd'
+ changed_when: '_compose_up_cmd.rc == 0'
diff --git a/ansible/roles/med_dl/tasks/main.yaml b/ansible/roles/med_dl/tasks/main.yaml
index 8c28b2b..62d9b46 100644
--- a/ansible/roles/med_dl/tasks/main.yaml
+++ b/ansible/roles/med_dl/tasks/main.yaml
@@ -2,3 +2,8 @@
- name: 'Run the setup tasks'
ansible.builtin.import_tasks: 'setup.yaml'
+ tags: ['install']
+
+- name: 'Run the config tasks'
+ ansible.builtin.import_tasks: 'config.yaml'
+ tags: ['install', 'config']
diff --git a/ansible/roles/med_dl/tasks/setup.yaml b/ansible/roles/med_dl/tasks/setup.yaml
index b1a1873..c3053e8 100644
--- a/ansible/roles/med_dl/tasks/setup.yaml
+++ b/ansible/roles/med_dl/tasks/setup.yaml
@@ -1,13 +1,5 @@
---
-- name: 'setup | Ensure required vars are set'
- ansible.builtin.assert:
- that:
- - item | mandatory
- loop:
- - '{{ med_dl_nas_mount_path }}'
- no_log: true
-
- name: 'setup | Install required pkgs'
ansible.builtin.package:
name:
@@ -25,14 +17,3 @@
path: '/mnt/data'
state: 'mounted'
fstype: 'nfs'
-
-- name: 'setup | Copy the docker-compose file'
- ansible.builtin.template:
- src: 'docker-compose.yaml.j2'
- dest: 'docker-compose.yaml'
- mode: '644'
-
-- name: 'setup | Start the service'
- ansible.builtin.command: 'docker-compose up -d'
- register: '_compose_up_cmd'
- changed_when: '_compose_up_cmd.rc == 0'
diff --git a/ansible/roles/monitoring/meta/argument_specs.yaml b/ansible/roles/monitoring/meta/argument_specs.yaml
new file mode 100644
index 0000000..54b59c3
--- /dev/null
+++ b/ansible/roles/monitoring/meta/argument_specs.yaml
@@ -0,0 +1,10 @@
+---
+
+argument_specs:
+ main:
+ short_description: Main entry point for the monitoring role
+ description:
+ - This role installs the Prometheus + Grafana as systemd services.
+ author:
+ - Kumar Damani
+ options: {}
diff --git a/ansible/roles/monitoring/meta/main.yaml b/ansible/roles/monitoring/meta/main.yaml
new file mode 100644
index 0000000..93c21f6
--- /dev/null
+++ b/ansible/roles/monitoring/meta/main.yaml
@@ -0,0 +1,4 @@
+---
+
+dependencies:
+ - role: 'base'
diff --git a/ansible/roles/monitoring/tasks/config.yaml b/ansible/roles/monitoring/tasks/config.yaml
new file mode 100644
index 0000000..20e64db
--- /dev/null
+++ b/ansible/roles/monitoring/tasks/config.yaml
@@ -0,0 +1,13 @@
+---
+
+- name: 'config | Set the Prom config'
+ ansible.builtin.template:
+ src: 'prometheus.yml.j2'
+ dest: '/etc/prometheus/prometheus.yml'
+ mode: '644'
+
+- name: 'config | Start the service'
+ ansible.builtin.service:
+ name: 'prometheus'
+ state: 'restarted'
+ enabled: true
diff --git a/ansible/roles/monitoring/tasks/main.yaml b/ansible/roles/monitoring/tasks/main.yaml
index 256a09f..62d9b46 100644
--- a/ansible/roles/monitoring/tasks/main.yaml
+++ b/ansible/roles/monitoring/tasks/main.yaml
@@ -2,4 +2,8 @@
- name: 'Run the setup tasks'
ansible.builtin.import_tasks: 'setup.yaml'
- tags: 'monitoring'
+ tags: ['install']
+
+- name: 'Run the config tasks'
+ ansible.builtin.import_tasks: 'config.yaml'
+ tags: ['install', 'config']
diff --git a/ansible/roles/monitoring/tasks/setup.yaml b/ansible/roles/monitoring/tasks/setup.yaml
index 824d2db..63ab962 100644
--- a/ansible/roles/monitoring/tasks/setup.yaml
+++ b/ansible/roles/monitoring/tasks/setup.yaml
@@ -6,15 +6,3 @@
- 'prometheus'
- 'prometheus-node-exporter'
- 'prometheus-blackbox-exporter'
-
-- name: 'setup | Set the Prom config'
- ansible.builtin.template:
- src: 'prometheus.yml.j2'
- dest: '/etc/prometheus/prometheus.yml'
- mode: '644'
-
-- name: 'setup | Start the service'
- ansible.builtin.service:
- name: 'prometheus'
- state: 'restarted'
- enabled: true
diff --git a/ansible/roles/nextcloud/defaults/main.yaml b/ansible/roles/nextcloud/defaults/main.yaml
new file mode 100644
index 0000000..138231f
--- /dev/null
+++ b/ansible/roles/nextcloud/defaults/main.yaml
@@ -0,0 +1,10 @@
+---
+
+nextcloud_nas_mount_path: '{{ vaultvar_nextcloud_nas_nfs_path }}'
+nextcloud_php_max_mem_mb: 8000
+nextcloud_php_max_upload_size_gb: 10
+# You should have DRI devices showing up in your container in `/dev/dri/`.
+# See the TF readme for steps to enable this.
+# If not, then set this to false here.
+# Leave this as a yaml string, it is going to used as a shell var.
+nextcloud_enable_dri: 'true'
diff --git a/ansible/roles/nextcloud/meta/argument_specs.yaml b/ansible/roles/nextcloud/meta/argument_specs.yaml
new file mode 100644
index 0000000..60a7f85
--- /dev/null
+++ b/ansible/roles/nextcloud/meta/argument_specs.yaml
@@ -0,0 +1,25 @@
+---
+
+argument_specs:
+ main:
+ short_description: Main entry point for the Nextcloud AIO role
+ description:
+ - This role installs the Nextcloud All-in-One flavour as a Docker Compose project.
+ author:
+ - Kumar Damani
+ options:
+ nextcloud_nas_mount_path:
+ type: 'str'
+ required: true
+ description:
+ - The path to the data on the NFS share.
+ nextcloud_php_max_mem_mb:
+ type: 'int'
+ required: true
+ description:
+ - The max mem in MB to give PHP.
+ nextcloud_php_max_upload_size_gb:
+ type: 'int'
+ required: true
+ description:
+ - The max size in GB to allow for file uploads.
diff --git a/ansible/roles/nextcloud/meta/main.yaml b/ansible/roles/nextcloud/meta/main.yaml
new file mode 100644
index 0000000..bd4979e
--- /dev/null
+++ b/ansible/roles/nextcloud/meta/main.yaml
@@ -0,0 +1,5 @@
+---
+
+dependencies:
+ - role: 'base'
+ - role: 'docker'
diff --git a/ansible/roles/nextcloud/tasks/config.yaml b/ansible/roles/nextcloud/tasks/config.yaml
new file mode 100644
index 0000000..367e7d5
--- /dev/null
+++ b/ansible/roles/nextcloud/tasks/config.yaml
@@ -0,0 +1,12 @@
+---
+
+- name: 'config | Copy the docker-compose file'
+ ansible.builtin.template:
+ src: 'docker-compose.yaml.j2'
+ dest: 'docker-compose.yaml'
+ mode: '644'
+
+- name: 'config | Start the service'
+ ansible.builtin.command: 'docker-compose up -d'
+ register: '_compose_up_cmd'
+ changed_when: '_compose_up_cmd.rc == 0'
diff --git a/ansible/roles/nextcloud/tasks/main.yaml b/ansible/roles/nextcloud/tasks/main.yaml
index 0d3697b..62d9b46 100644
--- a/ansible/roles/nextcloud/tasks/main.yaml
+++ b/ansible/roles/nextcloud/tasks/main.yaml
@@ -2,4 +2,8 @@
- name: 'Run the setup tasks'
ansible.builtin.import_tasks: 'setup.yaml'
- tags: 'nextcloud'
+ tags: ['install']
+
+- name: 'Run the config tasks'
+ ansible.builtin.import_tasks: 'config.yaml'
+ tags: ['install', 'config']
diff --git a/ansible/roles/nextcloud/tasks/setup.yaml b/ansible/roles/nextcloud/tasks/setup.yaml
index ac17702..ae3bff9 100644
--- a/ansible/roles/nextcloud/tasks/setup.yaml
+++ b/ansible/roles/nextcloud/tasks/setup.yaml
@@ -1,15 +1,5 @@
---
-- name: 'setup | Ensure required vars are set'
- ansible.builtin.assert:
- that:
- - item | mandatory
- loop:
- - '{{ nextcloud_nas_mount_path }}'
- - '{{ nextcloud_php_max_mem_mb }}'
- - '{{ nextcloud_php_max_upload_size_gb }}'
- no_log: true
-
- name: 'setup | Install required pkgs'
ansible.builtin.package:
name:
@@ -27,14 +17,3 @@
path: '/mnt/data'
state: 'mounted'
fstype: 'nfs'
-
-- name: 'setup | Copy the docker-compose file'
- ansible.builtin.template:
- src: 'docker-compose.yaml.j2'
- dest: 'docker-compose.yaml'
- mode: '644'
-
-- name: 'setup | Start the service'
- ansible.builtin.command: 'docker-compose up -d'
- register: '_compose_up_cmd'
- changed_when: '_compose_up_cmd.rc == 0'
diff --git a/ansible/roles/plex/defaults/main.yaml b/ansible/roles/plex/defaults/main.yaml
new file mode 100644
index 0000000..94c410b
--- /dev/null
+++ b/ansible/roles/plex/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+
+plex_nas_mount_path: '{{ vaultvar_torrents_nas_nfs_path }}'
diff --git a/ansible/roles/plex/meta/argument_specs.yaml b/ansible/roles/plex/meta/argument_specs.yaml
new file mode 100644
index 0000000..7c49c67
--- /dev/null
+++ b/ansible/roles/plex/meta/argument_specs.yaml
@@ -0,0 +1,15 @@
+---
+
+argument_specs:
+ main:
+ short_description: Main entry point for the Plex role
+ description:
+ - This role installs the Plex Media Server as a systemd service.
+ author:
+ - Kumar Damani
+ options:
+ plex_nas_mount_path:
+ type: 'str'
+ required: true
+ description:
+ - The path to the data on the NFS share.
diff --git a/ansible/roles/plex/meta/main.yaml b/ansible/roles/plex/meta/main.yaml
new file mode 100644
index 0000000..93c21f6
--- /dev/null
+++ b/ansible/roles/plex/meta/main.yaml
@@ -0,0 +1,4 @@
+---
+
+dependencies:
+ - role: 'base'
diff --git a/ansible/roles/plex/tasks/main.yaml b/ansible/roles/plex/tasks/main.yaml
index 5469534..506eb4c 100644
--- a/ansible/roles/plex/tasks/main.yaml
+++ b/ansible/roles/plex/tasks/main.yaml
@@ -2,4 +2,4 @@
- name: 'Run the setup tasks'
ansible.builtin.import_tasks: 'setup.yaml'
- tags: 'plex'
+ tags: ['install']
diff --git a/ansible/roles/torrents/defaults/main.yaml b/ansible/roles/torrents/defaults/main.yaml
new file mode 100644
index 0000000..45c9780
--- /dev/null
+++ b/ansible/roles/torrents/defaults/main.yaml
@@ -0,0 +1,5 @@
+---
+
+torrents_nas_mount_path: '{{ vaultvar_torrents_nas_nfs_path }}'
+torrents_rpc_username: '{{ vaultvar_torrents_rpc_username }}'
+torrents_rpc_password: '{{ vaultvar_torrents_rpc_password }}'
diff --git a/ansible/roles/torrents/meta/argument_specs.yaml b/ansible/roles/torrents/meta/argument_specs.yaml
new file mode 100644
index 0000000..21691c7
--- /dev/null
+++ b/ansible/roles/torrents/meta/argument_specs.yaml
@@ -0,0 +1,25 @@
+---
+
+argument_specs:
+ main:
+ short_description: Main entry point for the torrents role
+ description:
+ - This role installs the Transmission server as a systemd service.
+ author:
+ - Kumar Damani
+ options:
+ torrents_nas_mount_path:
+ type: 'str'
+ required: true
+ description:
+ - The path to the data on the NFS share.
+ torrents_rpc_username:
+ type: 'str'
+ required: true
+ description:
+ - The username.
+ torrents_rpc_password:
+ type: 'str'
+ required: true
+ description:
+ - The psswd for the user.
diff --git a/ansible/roles/torrents/meta/main.yaml b/ansible/roles/torrents/meta/main.yaml
new file mode 100644
index 0000000..93c21f6
--- /dev/null
+++ b/ansible/roles/torrents/meta/main.yaml
@@ -0,0 +1,4 @@
+---
+
+dependencies:
+ - role: 'base'
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
diff --git a/ansible/roles/vault/meta/argument_specs.yaml b/ansible/roles/vault/meta/argument_specs.yaml
new file mode 100644
index 0000000..9e8ccd6
--- /dev/null
+++ b/ansible/roles/vault/meta/argument_specs.yaml
@@ -0,0 +1,10 @@
+---
+
+argument_specs:
+ main:
+ short_description: Main entry point for the vault role
+ description:
+ - This role installs Vaultwarden (a FOSS fork of Bitwarden) as a Docker Compose project.
+ author:
+ - Kumar Damani
+ options: {}
diff --git a/ansible/roles/vault/meta/main.yaml b/ansible/roles/vault/meta/main.yaml
new file mode 100644
index 0000000..bd4979e
--- /dev/null
+++ b/ansible/roles/vault/meta/main.yaml
@@ -0,0 +1,5 @@
+---
+
+dependencies:
+ - role: 'base'
+ - role: 'docker'
diff --git a/ansible/roles/vault/tasks/main.yaml b/ansible/roles/vault/tasks/main.yaml
index 191bbc1..506eb4c 100644
--- a/ansible/roles/vault/tasks/main.yaml
+++ b/ansible/roles/vault/tasks/main.yaml
@@ -2,4 +2,4 @@
- name: 'Run the setup tasks'
ansible.builtin.import_tasks: 'setup.yaml'
- tags: 'vault'
+ tags: ['install']