Compare commits

..

7 Commits

Author SHA1 Message Date
09d5241481 build
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2025-10-29 10:21:34 +01:00
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
07bc2d0b71 added photo nfs
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-10-21 14:28:37 +02:00
0de7960a3a lala 2025-10-21 08:17:22 +02:00
8 changed files with 256 additions and 44 deletions

View File

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

View File

@@ -163,3 +163,11 @@ datacenter:
# ansible_user: admin
# ansible_pass: l4c1!j4yd33?Du5lo1
ansible_python_interpreter: /share/ZFS530_DATA/.qpkg/QPython312/bin/python3
desktops:
hosts:
morefine.home.lan:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_ssh_user: jd
ansible_become_password: q
ansible_ssh_private_key_file: ssh_key.pem

View File

@@ -24,52 +24,125 @@
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
mode: '0600'
owner: root
group: root
- name: Creating a file with content
ansible.builtin.copy:
dest: "/etc/auto.nas-movies"
content: |
movies -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/movies
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.nas-music"
dest: "/etc/auto.rack"
content: |
music -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/music
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.nas-shows"
dest: "/etc/auto.rpi5"
content: |
shows -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/shows
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"
# content: |
# movies -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,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"
# content: |
# music -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/music
# 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=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/shows
# mode: '0600'
# owner: root
# group: root
# - name: Creating a file with content
# ansible.builtin.copy:
# dest: "/etc/auto.nas"
# content: |
# nas-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Data
# nas-docker-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/docker_data
# nas-photo -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Photo
# nas-public -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Public
# nas-install -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/install
# nas-downloads -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/downloads
# nas-games -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/qda_2
# mode: '0600'
# owner: root
# group: root
- name: Creating a file with content
ansible.builtin.copy:
dest: "/etc/auto.nas"
content: |
nas-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Data
nas-docker-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/docker_data
nas-photo -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Photo
nas-public -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Public
nas-install -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/install
nas-downloads -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/downloads
nas-games -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/qda_2
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
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
@@ -77,32 +150,48 @@
# insertafter: '^/media/nas'
# line: "/media/nas /etc/auto.nas --timeout 360 --ghost"
- name: Reconfigure autofs Server
ansible.builtin.lineinfile:
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/shows/nas.*"
line: /media/data/shows/nas /etc/auto.nas-shows --timeout 360 --ghost
# - name: Reconfigure autofs Server
# ansible.builtin.lineinfile:
# 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/shows/nas.*"
# line: /media/data/shows/nas /etc/auto.nas-shows --timeout 360 --ghost
- 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
)

View File

@@ -54,6 +54,14 @@
group: root
remote_src: true
when: inventory_hostname != 'nas.home.lan'
- name: Upload monitors script
ansible.builtin.copy:
src: "get_monitors.sh"
dest: /myapps/mqtt_srv/get_monitors.sh
mode: '0755'
owner: root
group: root
when: inventory_hostname == 'morefine.home.lan'
- name: Upload service req
ansible.builtin.copy:
src: "{{ dest_folder }}/requirements.txt"

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

@@ -0,0 +1,73 @@
- 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 fstab
ansible.builtin.lineinfile:
path: /etc/fstab
regexp: "^/media/m-server/downloads .*"
line: "/media/m-server/downloads /srv/nfs/downloads none bind 0 0"
when: inventory_hostname == 'm-server.home.lan'
- name: Reconfigure nfs exports
ansible.builtin.lineinfile:
path: /etc/fstab
regexp: "^/share/docker_data .*"
line: "/share/docker_data /srv/nfs/docker_data none bind 0 0"
when: inventory_hostname == 'm-server.home.lan'
- 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

View File

@@ -59,7 +59,15 @@
owner: root
group: root
when: inventory_hostname != 'nas.home.lan'
- name: Upload docker_backups.py
ansible.builtin.copy:
src: "{{ dest_folder }}/docker_backups.py"
dest: /myapps/docker_backups.py
remote_src: true
mode: '0755'
owner: root
group: root
when: inventory_hostname == 'm-server.home.lan'
- name: Install venv
ansible.builtin.apt:
name:

View File

@@ -10,23 +10,20 @@
ansible.builtin.set_fact:
active_adapter: '{{ item }}'
loop: '{{ ansible_facts.interfaces }}'
when: 'item.startswith("eno")'
- name: Display all interfaces name
ansible.builtin.debug:
msg: "{{ ansible_default_ipv4.interface }}"
when: '(item.startswith("eno") or item.startswith("enp")) and not item.endswith("avahi")'
- name: Creating config
become: true
ansible.builtin.copy:
dest: "/etc/systemd/system/wol.service"
dest: "/etc/systemd/system/wol@.service"
content: |
[Unit]
Description=Enable Wake On Lan
[Service]
Type=oneshot
ExecStart = /usr/sbin/ethtool --change {{ ansible_default_ipv4.interface }} wol g
ExecStart = /usr/sbin/ethtool --change %i wol g
[Install]
WantedBy=basic.target
@@ -34,7 +31,9 @@
mode: '0744'
- name: Restart service wol, in all cases
ansible.builtin.service:
name: wol
name: wol@{{ item }}
state: restarted
enabled: true
become: true
loop: '{{ ansible_facts.interfaces }}'
when: '(item.startswith("eno") or item.startswith("enp")) and not item.endswith("avahi")'