diff --git a/archivewarrior.tf b/archivewarrior.tf new file mode 100644 index 0000000..dcbd410 --- /dev/null +++ b/archivewarrior.tf @@ -0,0 +1,48 @@ +resource "proxmox_lxc" "archivewarrior" { + target_node = "ryuk2" + hostname = "archivewarrior" + vmid = 221 + ostemplate = "cephfs:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst" + password = "terraform" + unprivileged = true + cores = 6 + memory = 8256 + swap = 1024 + start = true + tags = "terraform" + nameserver = "192.168.0.24" + ssh_public_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFw70PrMsilcsqCrwW1I6PAt3anQbhmVg+t/HUfomug ryan@mxDesktop" + + features { + nesting = true + } + + rootfs { + storage = "local-lvm" + size = "128G" + } + + #mountpoint{ + # key = "0" + # slot = 0 + # storage = "Ceph" + # mp = "/data" + # size = "400G" + #} + + network { + name = "eth0" + bridge = "vmbr0" + ip = "192.168.0.80/24" + gw = "192.168.0.1" + + } + + provisioner "local-exec" { + command = "./.ansible.d/setup.sh $IP" + environment = { + IP = "192.168.0.80" + } + } + +} diff --git a/roles/ind/archivewarrior/cron.vars b/roles/ind/archivewarrior/cron.vars new file mode 100644 index 0000000..c59b8f8 --- /dev/null +++ b/roles/ind/archivewarrior/cron.vars @@ -0,0 +1,18 @@ +--- +cronjob: + + - name: appdata + job_name: "Daily /data/ Backup" + job_minute: "0" + job_hour: "3" + job_day: "*" + user: "root" + job_command: "/home/restic/restic.sh --backup /data/ " + + - name: weeklydb + job_name: "Weekly /data/ verification" + job_minute: "10" + job_hour: "6" + job_day: "1" + user: "root" + job_command: "/home/restic/restic.sh --verify /data/" \ No newline at end of file diff --git a/roles/ind/archivewarrior/wikmd-install.yml b/roles/ind/archivewarrior/wikmd-install.yml new file mode 100644 index 0000000..28d646f --- /dev/null +++ b/roles/ind/archivewarrior/wikmd-install.yml @@ -0,0 +1,93 @@ +--- +- hosts: all + become: yes + remote_user: ansible + gather_facts: false + + vars: + docker_compose_definition: | + services: + watchtower: + image: containrrr/watchtower:latest + command: --cleanup --label-enable --interval 3600 + container_name: Watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock + labels: + com.centurylinklabs.watchtower.enable: "true" + restart: unless-stopped + + archiveTeamWarrior: + image: atdr.meo.ws/archiveteam/warrior-dockerfile + container_name: archiveTeamWarrior + hostname: archiveTeamWarrior + environment: + - SELECTED_PROJECT=auto + - SHARED_RSYNC_THREADS=20 + - WARRIOR_ID=jester45 + - CONCURRENT_ITEMS=24 + ports: + - "8001:8001" + labels: + com.centurylinklabs.watchtower.enable: "true" + restart: always + + tasks: + - name: Upgrade-packages.yml - update packages + include: ../../lib/upgrade-packages.yml + + - name: Install-docker.yml - setting up docker + include: ../../lib/install-docker.yml + + - name: Install Restic and setup + include: ../../lib/setup-restic.yml + + - name: Setup Restic Cron jobs + include: ../../lib/setup-restic-cron.yml + + - name: Install Python Packages + apt: + name: + - python3-full + - python3-pip + state: present + update_cache: yes + + - name: Setup Service + copy: + dest: /etc/systemd/system/wikmd.service + content: | + [Unit] + Description=Warrior + After=network.target + + [Service] + User=docker + WorkingDirectory=/home/docker + ExecStart=/usr/bin/docker compose -f docker-compose.yml up -d + ExecStop=/usr/bin/docker compose -f docker-compose.yml down + Restart=always + + [Install] + WantedBy=multi-user.target + owner: root + group: root + mode: '0644' + + - name: Write docker-compose.yml + ansible.builtin.copy: + content: "{{ docker_compose_definition }}" + dest: /home/docker/docker-compose.yml + owner: docker + group: docker + mode: u=rw,g=r,o=r + + - name: Reload systemd daemon + systemd: + daemon_reload: yes + + - name: Start Wikmd Service + systemd: + name: Warrior + state: started + enabled: yes \ No newline at end of file