0x90-pyinfra/deploy.py

54 lines
1.4 KiB
Python
Raw Normal View History

2024-05-16 19:18:15 +00:00
from pyinfra import host, local
from pyinfra.facts import server
from pyinfra.operations import files
from pyinfra.operations import server as o_server
2024-05-16 19:18:15 +00:00
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,
2024-10-07 00:49:46 +00:00
# _sudo=True,
)
2024-05-16 19:18:15 +00:00
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")
2024-10-07 00:49:46 +00:00
if host.name == "www":
local.include("www/deploy.py")