From 537beb7f6733af4103642f32e1ad950e258ecd88 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 8 Jun 2022 14:28:48 -0400 Subject: [PATCH] reformat project; start vm provisioning --- .gitignore | 49 +++++++++++ README.md | 5 ++ ansible/roles/media/tasks/main.yml | 10 --- {ansible => applications}/ansible.cfg | 0 applications/group_vars/all | 8 ++ {ansible => applications}/hosts | 0 .../roles/base/README.md | 0 .../roles/base/defaults/main.yml | 0 .../roles/base/handlers/main.yml | 0 .../roles/base/meta/main.yml | 0 .../roles/base/tasks/containers.yml | 0 .../roles/base/tasks/main.yml | 0 .../roles/base/vars/main.yml | 0 .../roles/media-manager/README.md | 0 .../roles/media-manager/defaults/main.yml | 0 .../roles/media-manager/handlers/main.yml | 0 .../roles/media-manager/meta/main.yml | 0 .../roles/media-manager/tasks/main.yml | 16 +++- .../roles/media-manager/vars/main.yml | 0 .../roles/media/README.md | 0 .../roles/media/defaults/main.yml | 0 .../roles/media/handlers/main.yml | 0 .../roles/media/meta/main.yml | 0 applications/roles/media/tasks/main.yml | 13 +++ .../roles/media/vars/main.yml | 0 {ansible => applications}/site.yml | 0 machines/vms/.terraform.lock.hcl | 23 +++++ machines/vms/main.tf | 88 +++++++++++++++++++ templates/hosts.tmpl | 18 ++++ 29 files changed, 219 insertions(+), 11 deletions(-) create mode 100644 .gitignore delete mode 100644 ansible/roles/media/tasks/main.yml rename {ansible => applications}/ansible.cfg (100%) create mode 100644 applications/group_vars/all rename {ansible => applications}/hosts (100%) rename {ansible => applications}/roles/base/README.md (100%) rename {ansible => applications}/roles/base/defaults/main.yml (100%) rename {ansible => applications}/roles/base/handlers/main.yml (100%) rename {ansible => applications}/roles/base/meta/main.yml (100%) rename {ansible => applications}/roles/base/tasks/containers.yml (100%) rename {ansible => applications}/roles/base/tasks/main.yml (100%) rename {ansible => applications}/roles/base/vars/main.yml (100%) rename {ansible => applications}/roles/media-manager/README.md (100%) rename {ansible => applications}/roles/media-manager/defaults/main.yml (100%) rename {ansible => applications}/roles/media-manager/handlers/main.yml (100%) rename {ansible => applications}/roles/media-manager/meta/main.yml (100%) rename {ansible => applications}/roles/media-manager/tasks/main.yml (92%) rename {ansible => applications}/roles/media-manager/vars/main.yml (100%) rename {ansible => applications}/roles/media/README.md (100%) rename {ansible => applications}/roles/media/defaults/main.yml (100%) rename {ansible => applications}/roles/media/handlers/main.yml (100%) rename {ansible => applications}/roles/media/meta/main.yml (100%) create mode 100644 applications/roles/media/tasks/main.yml rename {ansible => applications}/roles/media/vars/main.yml (100%) rename {ansible => applications}/site.yml (100%) create mode 100644 machines/vms/.terraform.lock.hcl create mode 100644 machines/vms/main.tf create mode 100644 templates/hosts.tmpl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b15661 --- /dev/null +++ b/.gitignore @@ -0,0 +1,49 @@ +## TERRAFORM + +# Compiled files +*.tfstate +*.tfstate.backup +*.tfstate.lock.info + +# logs +*.log + +# Directories +.terraform/ +.vagrant/ + +# SSH Keys +*.pem + +# Backup files +*.bak + +# Ignored Terraform files +*gitignore*.tf + +# Ignore Mac .DS_Store files +.DS_Store + +# Ignored vscode files +.vscode/ + +# Ignore Any Generated JSON Files +operations/automation-script/apply.json +operations/automation-script/configversion.json +operations/automation-script/run.template.json +operations/automation-script/run.json +operations/automation-script/variable.template.json +operations/automation-script/variable.json +operations/automation-script/workspace.template.json +operations/automation-script/workspace.json +operations/sentinel-policies-scripts/create-policy.template.json +operations/sentinel-policies-scripts/create-policy.json +operations/variable-scripts/variable.template.json +operations/variable-scripts/variable.json + +# Sentinel runtime directory +.sentinel + + +### ANSIBLE +*.retry \ No newline at end of file diff --git a/README.md b/README.md index 8fc21b7..c741d76 100644 --- a/README.md +++ b/README.md @@ -72,4 +72,9 @@ Production (Docker) - Important Services * Nginx Proxy Manager * Uptime Kuma +## Storage +NAS (TrueNAS Scale) + * No Major Requirements + + --- diff --git a/ansible/roles/media/tasks/main.yml b/ansible/roles/media/tasks/main.yml deleted file mode 100644 index 7d41cd7..0000000 --- a/ansible/roles/media/tasks/main.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- 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/ansible.cfg b/applications/ansible.cfg similarity index 100% rename from ansible/ansible.cfg rename to applications/ansible.cfg diff --git a/applications/group_vars/all b/applications/group_vars/all new file mode 100644 index 0000000..611506f --- /dev/null +++ b/applications/group_vars/all @@ -0,0 +1,8 @@ +--- +MEDIA_FOLDER: /mnt/media +CONFIG_FOLDER: /mnt/apps +DOWNLOADS_FOLDER: /mnt/media/downloads + +TZ: America/New_York +PUID: 1000 +PGID: 1000 \ No newline at end of file diff --git a/ansible/hosts b/applications/hosts similarity index 100% rename from ansible/hosts rename to applications/hosts diff --git a/ansible/roles/base/README.md b/applications/roles/base/README.md similarity index 100% rename from ansible/roles/base/README.md rename to applications/roles/base/README.md diff --git a/ansible/roles/base/defaults/main.yml b/applications/roles/base/defaults/main.yml similarity index 100% rename from ansible/roles/base/defaults/main.yml rename to applications/roles/base/defaults/main.yml diff --git a/ansible/roles/base/handlers/main.yml b/applications/roles/base/handlers/main.yml similarity index 100% rename from ansible/roles/base/handlers/main.yml rename to applications/roles/base/handlers/main.yml diff --git a/ansible/roles/base/meta/main.yml b/applications/roles/base/meta/main.yml similarity index 100% rename from ansible/roles/base/meta/main.yml rename to applications/roles/base/meta/main.yml diff --git a/ansible/roles/base/tasks/containers.yml b/applications/roles/base/tasks/containers.yml similarity index 100% rename from ansible/roles/base/tasks/containers.yml rename to applications/roles/base/tasks/containers.yml diff --git a/ansible/roles/base/tasks/main.yml b/applications/roles/base/tasks/main.yml similarity index 100% rename from ansible/roles/base/tasks/main.yml rename to applications/roles/base/tasks/main.yml diff --git a/ansible/roles/base/vars/main.yml b/applications/roles/base/vars/main.yml similarity index 100% rename from ansible/roles/base/vars/main.yml rename to applications/roles/base/vars/main.yml diff --git a/ansible/roles/media-manager/README.md b/applications/roles/media-manager/README.md similarity index 100% rename from ansible/roles/media-manager/README.md rename to applications/roles/media-manager/README.md diff --git a/ansible/roles/media-manager/defaults/main.yml b/applications/roles/media-manager/defaults/main.yml similarity index 100% rename from ansible/roles/media-manager/defaults/main.yml rename to applications/roles/media-manager/defaults/main.yml diff --git a/ansible/roles/media-manager/handlers/main.yml b/applications/roles/media-manager/handlers/main.yml similarity index 100% rename from ansible/roles/media-manager/handlers/main.yml rename to applications/roles/media-manager/handlers/main.yml diff --git a/ansible/roles/media-manager/meta/main.yml b/applications/roles/media-manager/meta/main.yml similarity index 100% rename from ansible/roles/media-manager/meta/main.yml rename to applications/roles/media-manager/meta/main.yml diff --git a/ansible/roles/media-manager/tasks/main.yml b/applications/roles/media-manager/tasks/main.yml similarity index 92% rename from ansible/roles/media-manager/tasks/main.yml rename to applications/roles/media-manager/tasks/main.yml index 9aff7de..182321b 100644 --- a/ansible/roles/media-manager/tasks/main.yml +++ b/applications/roles/media-manager/tasks/main.yml @@ -3,6 +3,8 @@ - name: Create media network community.docker.docker_network: name: media + ipam_config: + subnet: 172.23.27.0/24 # Torrent Client - name: Deploy Transmission @@ -170,7 +172,19 @@ ports: - 5055:5055 - +- name: Deploy Requestrr + community.docker.docker_container: + name: requestrr + image: lscr.io/linuxserver/requestrr + restart_policy: unless-stopped + env: + - "TZ={{ TZ }}" + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + volumes: + - "{{ CONFIG_FOLDER }}/requestrr/config:/config" + ports: + - 4545:4545 # - name: Deploy Doplarr # community.docker.docker_container: diff --git a/ansible/roles/media-manager/vars/main.yml b/applications/roles/media-manager/vars/main.yml similarity index 100% rename from ansible/roles/media-manager/vars/main.yml rename to applications/roles/media-manager/vars/main.yml diff --git a/ansible/roles/media/README.md b/applications/roles/media/README.md similarity index 100% rename from ansible/roles/media/README.md rename to applications/roles/media/README.md diff --git a/ansible/roles/media/defaults/main.yml b/applications/roles/media/defaults/main.yml similarity index 100% rename from ansible/roles/media/defaults/main.yml rename to applications/roles/media/defaults/main.yml diff --git a/ansible/roles/media/handlers/main.yml b/applications/roles/media/handlers/main.yml similarity index 100% rename from ansible/roles/media/handlers/main.yml rename to applications/roles/media/handlers/main.yml diff --git a/ansible/roles/media/meta/main.yml b/applications/roles/media/meta/main.yml similarity index 100% rename from ansible/roles/media/meta/main.yml rename to applications/roles/media/meta/main.yml diff --git a/applications/roles/media/tasks/main.yml b/applications/roles/media/tasks/main.yml new file mode 100644 index 0000000..1326777 --- /dev/null +++ b/applications/roles/media/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: Deploy Plex + community.docker.docker_container: + name: plex + image: lscr.io/linuxserver/plex + restart_policy: unless-stopped + env: + - "PUID={{ PUID }}" + - "PGID={{ PGID }}" + - "VERSION=docker" + volumes: + - "{{ CONFIG_FOLDER }}/plex/config:/config" + - "{{ MEDIA_FOLDER }}:/content" diff --git a/ansible/roles/media/vars/main.yml b/applications/roles/media/vars/main.yml similarity index 100% rename from ansible/roles/media/vars/main.yml rename to applications/roles/media/vars/main.yml diff --git a/ansible/site.yml b/applications/site.yml similarity index 100% rename from ansible/site.yml rename to applications/site.yml diff --git a/machines/vms/.terraform.lock.hcl b/machines/vms/.terraform.lock.hcl new file mode 100644 index 0000000..23a6f57 --- /dev/null +++ b/machines/vms/.terraform.lock.hcl @@ -0,0 +1,23 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/telmate/proxmox" { + version = "2.9.10" + hashes = [ + "h1:mKgUaboSiulLR8RAHHr7w/VapyEKyQFzj8G+LjOjaLs=", + "zh:34670f912770e5e5fa72478335c069f4a5f9c7371eca87224d4dfc4ae26eb4c9", + "zh:36885990c5c584a0c86b92e1a2a56b6d7b700d8a2e2b80ab149124c339141e69", + "zh:43d8768ebcd781bad9dfb79e8fe3bb604e6c03050b2c4c88feada623737afbd5", + "zh:772681e016d0dbc0fe84782597cf40b423327151817b03af3df1a4c3623eda33", + "zh:814278951363f708951f8d05957fbeb43b6a1835720e245279c088275ea29605", + "zh:82b5865838ffad92d493ab8058938273c13d0b70e8ddc219cd60d87ad0c5870b", + "zh:8d53b293a9026d4082cc40332f51543dd36b1b94b76ac59853fd9cbaadbe8886", + "zh:ba071e675a90b149a67b58fe9a5c345017bd42574dd317e8f1a4d78bc80c3bcc", + "zh:caaa65e27e01efcab65a17e52f3356cc7f1222bcaf8c76bf9cef388d3d167d94", + "zh:d61402a8a2dfe4137d5c6789d8a63a9eebacbd3e0a7a6e79ed6ef00761ced064", + "zh:da5ae531c69114ab860180222f7254c377181d5493507f4af117d022fdaed708", + "zh:e3faeec4d0f394a9d94dd915e1ace16e7eec4dd051d4671a73580407b4358ce6", + "zh:ff434dcbccf92759ac4c253f6187a24e6acbc572228284057c79daa52264e0df", + "zh:ff60423b80a445a18a608e7b0b886bdfcaf8b4065a56078c4d845904abf48303", + ] +} diff --git a/machines/vms/main.tf b/machines/vms/main.tf new file mode 100644 index 0000000..bcd3c1d --- /dev/null +++ b/machines/vms/main.tf @@ -0,0 +1,88 @@ +terraform { + required_providers { + proxmox = { + source = "telmate/proxmox" + } + } +} + +provider "proxmox" { + pm_api_url = "" + pm_api_token_id = "" + pm_api_token_secret = "" + pm_tls_insecure = true +} + +resource "proxmox_vm_qemu" "media-server" { + count = 1 + name = "plex" + vmid = "200" + target_node = "milkyway" + clone = "ubuntu-2004-cloud" + agent = 1 + os_type = "cloud-init" + cores = 4 + sockets = 1 + cpu = "host" + memory = 4096 + scsihw = "virtio-scsi-pci" + bootdisk = "scsi0" + disk { + slot = 0 + size = "50G" + type = "scsi" + storage = "local-lvm" + iothread = 1 + } + + network { + model = "virtio" + bridge = "vmbr0" + } + + lifecycle { + ignore_changes = [ + network, + ] + } + + ipconfig0 = "ip=192.168.0.50/24,gw=192.168.0.1" +} + +resource "proxmox_vm_qemu" "media-manager" { + count = 1 + name = "media-manager" + vmid = "201" + target_node = "milkyway" + clone = "ubuntu-2004-cloud" + agent = 1 + os_type = "cloud-init" + cores = 4 + sockets = 1 + cpu = "host" + memory = 4096 + scsihw = "virtio-scsi-pci" + bootdisk = "scsi0" + disk { + slot = 0 + size = "20G" + type = "scsi" + storage = "local-lvm" + iothread = 1 + } + + network { + model = "virtio" + bridge = "vmbr0" + } + + lifecycle { + ignore_changes = [ + network, + ] + } + + ipconfig0 = "ip=192.168.0.51/24,gw=192.168.0.1" +} + + diff --git a/templates/hosts.tmpl b/templates/hosts.tmpl new file mode 100644 index 0000000..ee827f2 --- /dev/null +++ b/templates/hosts.tmpl @@ -0,0 +1,18 @@ +[media-managers] +%{ for ip in media-managers } +${ ip } +%{ end for } + +[media-servers] +%{ for ip in media-servers } +${ ip } +%{ end for } + +[docker-servers:children] +main-docker +media-managers + +[main-docker] +%{ for ip in main-docker } +${ ip } +%{ end for }