New server setup based on ubuntu

This commit is contained in:
Martin Bauer
2023-09-19 10:55:47 +02:00
parent 578be1a1cf
commit 7776095180
30 changed files with 240 additions and 186 deletions

View File

@@ -0,0 +1,21 @@
---
- name: Do apt update/upgrade
apt: upgrade=yes update_cache=yes cache_valid_time=300
- name: Apt install download & unzip packages
apt:
name:
- wget
- zip
- htop
- xz-utils
- python3
- python3-venv
- python3-wheel
- git
- iotop
- name: Download and install mbenv
ansible.builtin.unarchive:
src: "https://owncloud.bauer.tech/s/vMu7X4mRl2vComu/download?path=%2F&files=mbenv.tar.xz"
remote_src: yes
dest: "/home/core/"

View File

@@ -0,0 +1,38 @@
---
- name: Install required system packages
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- python3-pip
- virtualenv
- python3-setuptools
state: latest
update_cache: true
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/debian {{ ansible_facts['distribution_release'] }} stable
state: present
- name: Update apt and install docker-ce
apt:
name:
- docker-ce
- docker-compose-plugin
state: latest
update_cache: true
- name: Add core to docker group
ansible.builtin.user:
name: core
groups: docker
append: true

View File

@@ -0,0 +1,2 @@
ACTION=="add", SUBSYSTEM=="block", ENV{DEVLINKS}=="*/dev/disk/by-label/MartinsPassport4*", ENV{SYSTEMD_WANTS}="media-passport4.mount"
ACTION=="add", SUBSYSTEM=="block", ENV{DEVLINKS}=="*/dev/disk/by-label/MartinsPassport5*", ENV{SYSTEMD_WANTS}="media-passport5.mount"

View File

@@ -0,0 +1,12 @@
[Unit]
Description=Mount /dev/disk/by-label/MartinsPassport4 at /media/passport4
Before=local-fs.target
[Mount]
What=/dev/disk/by-label/MartinsPassport4
Where=/media/passport4
Type=btrfs
Options=noauto,nofail
[Install]
WantedBy=local-fs.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=Mount /dev/disk/by-label/MartinsPassport5 at /media/passport5
Before=local-fs.target
[Mount]
What=/dev/disk/by-label/MartinsPassport5
Where=/media/passport5
Type=btrfs
Options=noauto,nofail
[Install]
WantedBy=local-fs.target

View File

@@ -0,0 +1,14 @@
---
- name: Automount passport4 systemd file
copy: src=media-passport4.mount dest=/etc/systemd/system
- name: Automount passport5 systemd file
copy: src=media-passport5.mount dest=/etc/systemd/system
- name: Create udev rules
copy: src=99-automounts.rules dest=/etc/udev/rules.d
- name: Systemd reread configs
ansible.builtin.systemd:
daemon_reload: true
- name: Reload udev
ansible.builtin.command:
cmd: "udevadm control --reload"

View File

@@ -0,0 +1,20 @@
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
## The primary network interface
#allow-hotplug enp2s0
#iface enp2s0 inet dhcp
## This is an autoconfigured IPv6 interface
#iface enp2s0 inet6 auto
auto bond0
iface bond0 inet dhcp
bond-slaves enp3s0 enp4s0 enp5s0
bond-mode 802.3ad
bond-lacp-rate 1
bond-miimon 100
bond-xmit-hash-policy layer3+4

View File

@@ -0,0 +1,8 @@
---
- name: Apt install download & unzip packages
apt:
name:
- ifenslave
- name: Interface file
copy: src=interfaces dest=/etc/network/interfaces

View File

@@ -0,0 +1,20 @@
---
- name: Apt install NFS server
apt:
name: nfs-kernel-server
update_cache: yes
- name: Ensure correct entry in /etc/exports
lineinfile:
path: /etc/exports
state: present
line: "{{ item }}"
with_items:
- '/data/main 192.168.178.0/255.255.255.0(rw,async,no_subtree_check)'
- name: Restart nfs-kernel-server.service
ansible.builtin.systemd:
daemon_reload: yes
state: started
name: nfs-kernel-server.service