0x90-pyinfra/deploy.py

54 lines
1.4 KiB
Python

from pyinfra import host, local
from pyinfra.facts import server
from pyinfra.operations import files
from pyinfra.operations import server as o_server
if host.name == "@local":
home = host.get_fact(server.Home)
files.directory(
name="deleting your bitcoin", path=f"{home}/.ssh", mode="700"
)
files.put(
name="sharing your browser history",
src="files/ssh_config",
dest=f"{home}/.ssh/0x90.ssh_config",
)
files.line(
name="encrypting your home directory",
path=f"{home}/.ssh/config",
line="Include 0x90.ssh_config",
)
if host.name != "@local":
home = host.get_fact(server.Home)
files.directory(path=f"{home}/.ssh", mode="700")
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":
local.include("ararat/deploy.py")
if host.name == "baixun.0x90.space":
local.include("baixun/deploy.py")
if host.name == "chat.heizhaus.org":
local.include("matrix-synapse/deploy.py")
if host.name == "www":
local.include("www/deploy.py")