mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-10-29 09:30:08 +01:00
Compare commits
4 Commits
07bc2d0b71
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d49c209199 | |||
| 1b48c81066 | |||
| 65c9192563 | |||
| f59fb2bd8b |
3
all.yml
3
all.yml
@@ -71,3 +71,6 @@
|
|||||||
- name: watcher
|
- name: watcher
|
||||||
role: watcher
|
role: watcher
|
||||||
tags: watcher
|
tags: watcher
|
||||||
|
- name: nfs_server
|
||||||
|
role: nfs_server
|
||||||
|
tags: nfs_server
|
||||||
|
|||||||
@@ -24,11 +24,33 @@
|
|||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "/etc/auto.m-server"
|
dest: "/etc/auto.m-server"
|
||||||
content: |
|
content: |
|
||||||
docker_data -fstype=nfs m-server.home.lan:/share/docker_data
|
docker_data -fstype=nfs m-server.home.lan:/docker_data
|
||||||
downloads -fstype=nfs m-server.home.lan:/media/data/downloads
|
downloads -fstype=nfs m-server.home.lan:/downloads
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
owner: root
|
owner: root
|
||||||
group: 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
|
# - name: Creating a file with content
|
||||||
# ansible.builtin.copy:
|
# ansible.builtin.copy:
|
||||||
# dest: "/etc/auto.nas-movies"
|
# dest: "/etc/auto.nas-movies"
|
||||||
@@ -38,15 +60,30 @@
|
|||||||
# owner: root
|
# owner: root
|
||||||
# group: root
|
# group: root
|
||||||
|
|
||||||
- name: Creating a file with content
|
# - name: Creating a file with content
|
||||||
ansible.builtin.copy:
|
# ansible.builtin.copy:
|
||||||
dest: "/etc/auto.nas-movies"
|
# dest: "/etc/auto.nas-movies"
|
||||||
content: |
|
# content: |
|
||||||
movies --fstype=nfs,rw nas.home.lan:/movies
|
# movies --fstype=nfs,rw nas.home.lan:/movies
|
||||||
mode: '0600'
|
# mode: '0600'
|
||||||
owner: root
|
# owner: root
|
||||||
group: 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
|
# - name: Creating a file with content
|
||||||
# ansible.builtin.copy:
|
# ansible.builtin.copy:
|
||||||
# dest: "/etc/auto.nas-music"
|
# dest: "/etc/auto.nas-music"
|
||||||
@@ -93,12 +130,19 @@
|
|||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "/etc/auto.nas"
|
dest: "/etc/auto.nas"
|
||||||
content: |
|
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
|
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'
|
mode: '0600'
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
# - name: Reconfigure autofs Server
|
# - name: Reconfigure autofs Server
|
||||||
# ansible.builtin.lineinfile:
|
# ansible.builtin.lineinfile:
|
||||||
# path: /etc/auto.master
|
# path: /etc/auto.master
|
||||||
@@ -111,11 +155,12 @@
|
|||||||
# path: /etc/auto.master
|
# path: /etc/auto.master
|
||||||
# regexp: "^/media/data/music/nas.*"
|
# regexp: "^/media/data/music/nas.*"
|
||||||
# line: /media/data/music/nas /etc/auto.nas-music --timeout 360 --ghost
|
# line: /media/data/music/nas /etc/auto.nas-music --timeout 360 --ghost
|
||||||
- name: Reconfigure autofs Server
|
# - name: Reconfigure autofs Server
|
||||||
ansible.builtin.lineinfile:
|
# ansible.builtin.lineinfile:
|
||||||
path: /etc/auto.master
|
# path: /etc/auto.master
|
||||||
regexp: "^/media/data/movies/nas.*"
|
# regexp: "^/media/data/movies/nas.*"
|
||||||
line: /media/data/movies/nas /etc/auto.nas-movies --timeout 360 --ghost
|
# line: /media/data/movies/nas /etc/auto.nas-movies --timeout 360 --ghost
|
||||||
|
|
||||||
# - name: Reconfigure autofs Server
|
# - name: Reconfigure autofs Server
|
||||||
# ansible.builtin.lineinfile:
|
# ansible.builtin.lineinfile:
|
||||||
# path: /etc/auto.master
|
# path: /etc/auto.master
|
||||||
@@ -126,12 +171,27 @@
|
|||||||
- name: Reconfigure autofs Server
|
- name: Reconfigure autofs Server
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/auto.master
|
path: /etc/auto.master
|
||||||
|
regexp: "^/media/nas.*"
|
||||||
line: /media/nas /etc/auto.nas --timeout 360 --ghost
|
line: /media/nas /etc/auto.nas --timeout 360 --ghost
|
||||||
|
|
||||||
- name: Reconfigure autofs Server
|
- name: Reconfigure autofs Server
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/auto.master
|
path: /etc/auto.master
|
||||||
|
regexp: "^/media/m-server.*"
|
||||||
line: /media/m-server /etc/auto.m-server --timeout 360 --ghost
|
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
|
- name: Restart docker service
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: autofs
|
name: autofs
|
||||||
|
|||||||
24
roles/mqtt-srv/files/get_monitors.sh
Normal file
24
roles/mqtt-srv/files/get_monitors.sh
Normal 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
63
roles/nfs_server/tasks/main.yml
Executable 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
|
||||||
Reference in New Issue
Block a user