create a pyinfra log file and a user for it, incluse matrix-synapse/deploy.py

This commit is contained in:
2e20 2024-10-06 19:43:19 +02:00
parent 09e31bbab9
commit bece765e3b

View file

@ -1,6 +1,7 @@
from pyinfra import host, local from pyinfra import host, local
from pyinfra.facts import server from pyinfra.facts import server
from pyinfra.operations import files from pyinfra.operations import files
from pyinfra.operations import server as o_server
if host.name == "@local": if host.name == "@local":
home = host.get_fact(server.Home) home = host.get_fact(server.Home)
@ -23,8 +24,27 @@ if host.name != "@local":
files.directory(path=f"{home}/.ssh", mode="700") files.directory(path=f"{home}/.ssh", mode="700")
files.put(src="files/authorized_keys", dest=f"{home}/.ssh/authorized_keys") files.put(src="files/authorized_keys", dest=f"{home}/.ssh/authorized_keys")
o_server.user(
name="Create pyinfra user for logs",
user="pyinfra",
home="/home/pyinfra/"
)
files.file(
name="Create pyinfra log file",
path="/var/log/pyinfra.log",
user="pyinfra",
group="pyinfra",
mode="644",
# _doas=True,
# _sudo=True,
)
if host.name == "ararat.0x90.space": if host.name == "ararat.0x90.space":
local.include("ararat/deploy.py") local.include("ararat/deploy.py")
if host.name == "baixun.0x90.space": if host.name == "baixun.0x90.space":
local.include("baixun/deploy.py") local.include("baixun/deploy.py")
if host.name == "chat.heizhaus.org":
local.include("matrix-synapse/deploy.py")