diff --git a/.env.agebox b/.env.agebox deleted file mode 100644 index ae7ac75..0000000 Binary files a/.env.agebox and /dev/null differ diff --git a/.justfile b/.justfile index 9b84444..62409ff 100644 --- a/.justfile +++ b/.justfile @@ -1,5 +1,6 @@ # Repo management tasks mod repo '.devfiles/justfile' +set dotenv-load := true export ANSIBLE_VAULT_PASSWORD_FILE := justfile_directory() + "/.decrypt-pass.txt" export ANSIBLE_BECOME_PASSWORD_FILE := justfile_directory() + "/.become-pass.txt" diff --git a/hosts/inventory.yaml b/hosts/inventory.yaml index 9c032a8..406ed41 100644 --- a/hosts/inventory.yaml +++ b/hosts/inventory.yaml @@ -3,8 +3,15 @@ homelab: ansible_become_method: doas children: docker: + +storage: + children: s3 + +s3: + vars: + ansible_become_method: doas hosts: - 10.0.10.101: + 10.0.10.160 docker: vars: diff --git a/opentofu/vms/s3.tf b/opentofu/vms/s3.tf index cebf4c0..bd21365 100644 --- a/opentofu/vms/s3.tf +++ b/opentofu/vms/s3.tf @@ -1,9 +1,15 @@ # docs: https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_container -resource "proxmox_virtual_environment_container" "banana-hoard" { - vm_id = 160 +variable "vm_names" { + type = list(string) + default = ["donkey-kong"] +} + +resource "proxmox_virtual_environment_container" "vm" { + for_each = toset(var.vm_names) + vm_id = 160 + index(var.vm_names, each.key) node_name = "pve" - description = "S3 data storage manager" + description = "S3 data storage" unprivileged = true start_on_boot = "true" @@ -14,17 +20,16 @@ resource "proxmox_virtual_environment_container" "banana-hoard" { } initialization { - hostname = "banana-hoard" + hostname = each.key ip_config { ipv4 { - address = "10.0.10.60/24" + address = "10.0.10.${160 + index(var.vm_names, each.key)}/24" gateway = "10.0.0.10" } } user_account { - # keys = [data.localfile.aleidk_key_pub.filename."/home/aleidk/Repos/Private/homelab/"] password = var.root_password } } diff --git a/playbooks/storage/s3.yaml b/playbooks/storage/s3.yaml new file mode 100644 index 0000000..fdcea1d --- /dev/null +++ b/playbooks/storage/s3.yaml @@ -0,0 +1,34 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/refs/heads/main/src/ansiblelint/schemas/playbook.json + +--- +- name: Setup S3 storage + hosts: s3 + tasks: + - name: Install MinIO + become: true + apk: + name: minio + update_cache: yes + + - name: Create MinIO directories + become: true + file: + path: /data/minio + state: directory + owner: minio + group: minio + mode: '0755' + + - name: Configure MinIO + copy: + dest: /etc/default/minio + content: | + MINIO_VOLUMES="/data/minio/" + MINIO_OPTS="--address :9000" + + - name: Enable and start MinIO service + service: + name: minio + enabled: yes + state: started +