add common/deploy.py
This commit is contained in:
parent
1787d57118
commit
1967a627ba
93
common/deploy.py
Normal file
93
common/deploy.py
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
from pyinfra import host
|
||||
from pyinfra.operations import apt, server, files
|
||||
from pyinfra.facts.server import LinuxName
|
||||
|
||||
files_path = "files/common/"
|
||||
template_path = files_path +"template/"
|
||||
|
||||
## check on which Distribution the script is executed
|
||||
if host.get_fact(LinuxName) == "Debian":
|
||||
|
||||
## update apt repositories
|
||||
apt.update(
|
||||
name="update apt repositories",
|
||||
# _doas=True,
|
||||
# _doas_user="pyinfra",
|
||||
# _sudo=True,
|
||||
# _sudo_user="pyinfra",
|
||||
)
|
||||
|
||||
## install python3
|
||||
apt.packages(
|
||||
name="install python3",
|
||||
packages=["python3"],
|
||||
)
|
||||
|
||||
## install borgbackup
|
||||
apt.packages(
|
||||
name="install borgbackup",
|
||||
packages=["borgbackup"],
|
||||
)
|
||||
|
||||
|
||||
#elif host.get_fact(LinuxName) == "":
|
||||
else:
|
||||
print("matrix-synapse deploy.py don't support: \"" +host.get_fact(LinuxName) +"\" yet")
|
||||
exit("exit from matrix-synapse/deploy.py")
|
||||
|
||||
## create /etc/myname
|
||||
myname_path = template_path +"myname"
|
||||
files.put(
|
||||
name="create " +myname_path,
|
||||
src=myname_path,
|
||||
dest="/etc/myname",
|
||||
)
|
||||
|
||||
## disable and stop sndiod
|
||||
service_name = "sndiod"
|
||||
server.service(
|
||||
name="disable and stop sndiod",
|
||||
service=service_name,
|
||||
enabled=False,
|
||||
running=False,
|
||||
)
|
||||
|
||||
## create /root/.ssh/config
|
||||
dotssh_conf_path = files_path +"dotssh_config"
|
||||
files.put(
|
||||
name="create /root/.ssh/config",
|
||||
src=dotssh_conf_path,
|
||||
dest="/root/.ssh/config",
|
||||
)
|
||||
|
||||
# ? when: provision is not defined or inventory_hostname == provision
|
||||
|
||||
## create /etc/hosts
|
||||
hosts_path = template_path +"hosts"
|
||||
files.put(
|
||||
name="create /etc/hosts",
|
||||
src=hosts_path,
|
||||
dest="/etc/hosts",
|
||||
)
|
||||
|
||||
# ? when: destroy is not defined or inventory_hostname != destroy
|
||||
|
||||
# ? - block:
|
||||
|
||||
## copy /etc/mail/aliases
|
||||
aliases_path = files_path +"aliases"
|
||||
files.put(
|
||||
name="copy /etc/mail/aliases",
|
||||
src=aliases_path,
|
||||
dest="/etc/mail/aliases",
|
||||
)
|
||||
|
||||
## create /etc/mail/smtpd.conf
|
||||
smtpd_conf_path = template_path +"smtpd.conf"
|
||||
files.put(
|
||||
name="create /etc/mail/smtpd.conf",
|
||||
src=smtpd_conf_path,
|
||||
dest="/etc/mail/smtpd.conf",
|
||||
)
|
||||
|
||||
# ? when: provision is not defined or inventory_hostname == provision
|
||||
Loading…
Reference in a new issue