Compare commits

...

4 Commits

Author SHA1 Message Date
d49c209199 build
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-26 02:20:22 +01:00
1b48c81066 build 2025-10-26 02:20:02 +01:00
65c9192563 klal
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-21 20:05:08 +02:00
f59fb2bd8b lala 2025-10-21 20:02:34 +02:00
4 changed files with 169 additions and 19 deletions

View File

@@ -71,3 +71,6 @@
- name: watcher
role: watcher
tags: watcher
- name: nfs_server
role: nfs_server
tags: nfs_server

View File

@@ -24,11 +24,33 @@
ansible.builtin.copy:
dest: "/etc/auto.m-server"
content: |
docker_data -fstype=nfs m-server.home.lan:/share/docker_data
downloads -fstype=nfs m-server.home.lan:/media/data/downloads
docker_data -fstype=nfs m-server.home.lan:/docker_data
downloads -fstype=nfs m-server.home.lan:/downloads
mode: '0600'
owner: root
group: root
when: inventory_hostname != 'm-server.home.lan'
- name: Creating a file with content
ansible.builtin.copy:
dest: "/etc/auto.rack"
content: |
docker_data -fstype=nfs rack.home.lan:/docker_data
mode: '0600'
owner: root
group: root
when: inventory_hostname != 'rack.home.lan'
- name: Creating a file with content
ansible.builtin.copy:
dest: "/etc/auto.rpi5"
content: |
docker_data -fstype=nfs rpi5.home.lan:/docker_data
mode: '0600'
owner: root
group: root
when: inventory_hostname != 'rpi5.home.lan'
# - name: Creating a file with content
# ansible.builtin.copy:
# dest: "/etc/auto.nas-movies"
@@ -38,15 +60,30 @@
# owner: root
# group: root
- name: Creating a file with content
ansible.builtin.copy:
dest: "/etc/auto.nas-movies"
content: |
movies --fstype=nfs,rw nas.home.lan:/movies
mode: '0600'
owner: root
group: root
# - name: Creating a file with content
# ansible.builtin.copy:
# dest: "/etc/auto.nas-movies"
# content: |
# movies --fstype=nfs,rw nas.home.lan:/movies
# mode: '0600'
# owner: root
# group: root
# - name: Creating a file with content
# ansible.builtin.copy:
# dest: "/etc/auto.nas-music"
# content: |
# music --fstype=nfs,rw nas.home.lan:/music
# mode: '0600'
# owner: root
# group: root
# - name: Creating a file with content
# ansible.builtin.copy:
# dest: "/etc/auto.nas-shows"
# content: |
# shows --fstype=nfs,rw nas.home.lan:/shows
# mode: '0600'
# owner: root
# group: root
# - name: Creating a file with content
# ansible.builtin.copy:
# dest: "/etc/auto.nas-music"
@@ -93,12 +130,19 @@
ansible.builtin.copy:
dest: "/etc/auto.nas"
content: |
nas-data --fstype=nfs,rw nas.home.lan:/Data
docker-data --fstype=nfs,rw nas.home.lan:/docker_data
data --fstype=nfs,rw nas.home.lan:/Data
qda_1 --fstype=nfs,rw nas.home.lan:/qda_1
nas-photo --fstype=nfs,rw nas.home.lan:/Photo
photo --fstype=nfs,rw nas.home.lan:/Photo
install --fstype=nfs,rw nas.home.lan:/install
games --fstype=nfs,rw nas.home.lan:/games
movies --fstype=nfs,rw nas.home.lan:/movies
music --fstype=nfs,rw nas.home.lan:/music
shows --fstype=nfs,rw nas.home.lan:/shows
mode: '0600'
owner: root
group: root
when: inventory_hostname != 'nas.home.lan'
# - name: Reconfigure autofs Server
# ansible.builtin.lineinfile:
# path: /etc/auto.master
@@ -111,11 +155,12 @@
# path: /etc/auto.master
# regexp: "^/media/data/music/nas.*"
# line: /media/data/music/nas /etc/auto.nas-music --timeout 360 --ghost
- name: Reconfigure autofs Server
ansible.builtin.lineinfile:
path: /etc/auto.master
regexp: "^/media/data/movies/nas.*"
line: /media/data/movies/nas /etc/auto.nas-movies --timeout 360 --ghost
# - name: Reconfigure autofs Server
# ansible.builtin.lineinfile:
# path: /etc/auto.master
# regexp: "^/media/data/movies/nas.*"
# line: /media/data/movies/nas /etc/auto.nas-movies --timeout 360 --ghost
# - name: Reconfigure autofs Server
# ansible.builtin.lineinfile:
# path: /etc/auto.master
@@ -126,12 +171,27 @@
- name: Reconfigure autofs Server
ansible.builtin.lineinfile:
path: /etc/auto.master
regexp: "^/media/nas.*"
line: /media/nas /etc/auto.nas --timeout 360 --ghost
- name: Reconfigure autofs Server
ansible.builtin.lineinfile:
path: /etc/auto.master
regexp: "^/media/m-server.*"
line: /media/m-server /etc/auto.m-server --timeout 360 --ghost
- name: Reconfigure autofs Server
ansible.builtin.lineinfile:
path: /etc/auto.master
regexp: "^/media/rack.*"
line: /media/rack /etc/auto.rack --timeout 360 --ghost
- name: Reconfigure autofs Server
ansible.builtin.lineinfile:
path: /etc/auto.master
regexp: "^/media/rpi5.*"
line: /media/rpi5 /etc/auto.rpi5 --timeout 360 --ghost
- name: Restart docker service
ansible.builtin.service:
name: autofs

View File

@@ -0,0 +1,24 @@
#!/bin/bash
rm /tmp/monitors.txt
while read -r output hex conn; do
[[ -z "$conn" ]] && conn=${output%%-*}
echo "$output;$(xxd -r -p <<< "$hex")">>/tmp/monitors.txt
done < <(xrandr --prop | awk '
!/^[ \t]/ {
if (output && hex) print output, hex, conn
output=$1
hex=""
}
/ConnectorType:/ {conn=$2}
/[:.]/ && h {
sub(/.*000000fc00/, "", hex)
hex = substr(hex, 0, 26) "0a"
sub(/0a.*/, "", hex)
h=0
}
h {sub(/[ \t]+/, ""); hex = hex $0}
/EDID.*:/ {h=1}
END {if (output && hex) print output, hex, conn}
' | sort
)

63
roles/nfs_server/tasks/main.yml Executable file
View File

@@ -0,0 +1,63 @@
- name: Setup autofs
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
block:
- name: Include vault
ansible.builtin.include_vars:
file: jaydee.yml
- name: Install nfs-server
ansible.builtin.apt:
name:
- nfs-kernel-server
state: present
- name: Ensure nfsd thread count is set
community.general.ini_file:
path: /etc/nfs.conf
section: nfsd
option: threads
value: "1"
no_extra_spaces: true
mode: '0644'
- name: Mount and bind a volume
ansible.posix.mount:
path: /srv/nfs/downloads
src: /media/m-server/downloads
opts: bind
state: mounted
fstype: none
when: inventory_hostname == 'm-server.home.lan'
- name: Mount and bind a volume
ansible.posix.mount:
path: /srv/nfs/docker_data
src: /share/docker_data
opts: bind
state: mounted
fstype: none
- name: Reconfigure nfs exports
ansible.builtin.lineinfile:
path: /etc/exports
regexp: "^/srv/nfs .*"
line: "/srv/nfs 192.168.77.0/24(rw,sync,no_subtree_check,crossmnt,fsid=0)"
- name: Reconfigure nfs exports
ansible.builtin.lineinfile:
path: /etc/exports
regexp: "^/srv/nfs/docker_data .*"
line: "/srv/nfs/docker_data 192.168.77.0/24(rw,sync,no_subtree_check)"
- name: Reconfigure nfs exports
ansible.builtin.lineinfile:
path: /etc/exports
regexp: "^/srv/nfs/downloads .*"
line: "/srv/nfs/downloads 192.168.77.0/24(rw,sync,no_subtree_check)"
when: inventory_hostname == 'm-server.home.lan'
- name: Restart nfs service
ansible.builtin.service:
name: nfs-server
state: restarted