commit 00e713e48f23c60b7bacd1f59c1d1a90708f53c4 Author: Juul Date: Fri May 16 17:37:10 2025 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..600d2d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode \ No newline at end of file diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..07e16a5 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +roles_path = roles \ No newline at end of file diff --git a/files/load-zfs-key.service b/files/load-zfs-key.service new file mode 100644 index 0000000..6f8cb73 --- /dev/null +++ b/files/load-zfs-key.service @@ -0,0 +1,2 @@ +[Service] +ExecStart=/usr/sbin/zfs load-key zwembad/pandorica \ No newline at end of file diff --git a/inventory.ini b/inventory.ini new file mode 100644 index 0000000..9b06487 --- /dev/null +++ b/inventory.ini @@ -0,0 +1,9 @@ +[cloudia] +192.168.122.117 ansible_user=juulk +158.101.219.42 ansible_user=juulk ansible_ssh_private_key_file="/home/juulk/.ssh/juulk@oracle" + +[replica] +192.168.122.109 ansible_user=juulk + +[debian] +192.168.122.4 \ No newline at end of file diff --git a/playbooks/juulflixplus.yaml b/playbooks/juulflixplus.yaml new file mode 100644 index 0000000..2529885 --- /dev/null +++ b/playbooks/juulflixplus.yaml @@ -0,0 +1,8 @@ +- name: Initialize JuulFlixPlus + hosts: debian + become: yes + roles: + - apt-upgrade + - install-packages + - install-zfs + - install-docker \ No newline at end of file diff --git a/playbooks/zfs.yaml b/playbooks/zfs.yaml new file mode 100644 index 0000000..c0357ac --- /dev/null +++ b/playbooks/zfs.yaml @@ -0,0 +1,5 @@ +- name: setup zfs + hosts: debian + become: yes + roles: + - auto-mount-zfs \ No newline at end of file diff --git a/roles/apt-upgrade/tasks/main.yml b/roles/apt-upgrade/tasks/main.yml new file mode 100644 index 0000000..d406cdf --- /dev/null +++ b/roles/apt-upgrade/tasks/main.yml @@ -0,0 +1,7 @@ +- name: Update apt cache + apt: + update_cache: yes + +- name: Upgrade all packages + apt: + upgrade: dist \ No newline at end of file diff --git a/roles/auto-mount-zfs/tasks/main.yml b/roles/auto-mount-zfs/tasks/main.yml new file mode 100644 index 0000000..5ee0a36 --- /dev/null +++ b/roles/auto-mount-zfs/tasks/main.yml @@ -0,0 +1,14 @@ +- name: Set keylocation for zfs + command: zfs set keylocation=file:///root/zfskey zwembad/pandorica + +- name: Create service for loading key + copy: + src: ../files/load-zfs-key.service + dest: /etc/systemd/system/load-zfs-key.service + notify: reload systemd + +- name: Enable and start service for key loading + systemd: + name: load-zfs-key.service + enabled: yes + state: started diff --git a/roles/install-docker/tasks/main.yml b/roles/install-docker/tasks/main.yml new file mode 100644 index 0000000..78f5549 --- /dev/null +++ b/roles/install-docker/tasks/main.yml @@ -0,0 +1,26 @@ +- name: Adding Docker GPG apt Key + apt_key: + url: https://download.docker.com/linux/ubuntu/gpg + state: present + +- name: Adding Docker Repository + apt_repository: + repo: deb https://download.docker.com/linux/ubuntu focal stable + state: present + +- name: Updating apt and installing docker-ce + apt: + name: docker-ce + state: latest + update_cache: true + +- name: Ensuring docker group exists + group: + name: docker + state: present + +- name: Add user to docker group + user: + name: juulk + groups: docker + append: yes \ No newline at end of file diff --git a/roles/install-packages/tasks/main.yml b/roles/install-packages/tasks/main.yml new file mode 100644 index 0000000..9e357f2 --- /dev/null +++ b/roles/install-packages/tasks/main.yml @@ -0,0 +1,12 @@ +- name: Installing all required software + apt: + pkg: + - curl + - gnupg + - htop + - less + - mktorrent + - p7zip-full + - powertop + - samba + - tree \ No newline at end of file diff --git a/roles/install-zfs/tasks/main.yml b/roles/install-zfs/tasks/main.yml new file mode 100644 index 0000000..aef7f8d --- /dev/null +++ b/roles/install-zfs/tasks/main.yml @@ -0,0 +1,15 @@ +- name: Enable contrib repo + command: sed -r -i'.BAK' 's/^deb(.*)$/deb\1 contrib/g' /etc/apt/sources.list + +- name: Install zfs + apt: + pkg: + - zfsutils-linux + - zfs-dkms + - zfs-zed + update_cache: true + +- name: Load zfs modules + modprobe: + name: zfs + state: present \ No newline at end of file