You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
42 lines
1.0 KiB
import os, uservar, checks, setup, sys
|
|
|
|
#os.system("sudo dnf install pwgen -y")
|
|
def func(string):
|
|
return ''.join(string.splitlines())
|
|
|
|
|
|
user=os.environ.get('USER')
|
|
|
|
#print(key)
|
|
|
|
|
|
#print(key)
|
|
|
|
file_path = os.path.dirname(os.path.realpath(__file__))
|
|
yml_path= "{}/inventory/host_uservar/matrix.{}".format(file_path, uservar.domain)
|
|
hosts_path = "{}/inventory/".format(file_path)
|
|
|
|
checks.checks()
|
|
|
|
try:
|
|
if not os.path.exists(yml_path):
|
|
os.makedirs(yml_path)
|
|
#os.mkdir(yml_path)
|
|
os.system("touch {}/uservar.yml".format(yml_path))
|
|
os.system("touch {}/hosts".format(hosts_path))
|
|
with open('{}/hosts'.format(hosts_path), 'w') as f:
|
|
hosts_write = [
|
|
"[matrix_servers]\n",
|
|
"matrix.{} ansible_host={} ansible_port={} ansible_ssh_user=root".format(uservar.domain, uservar.ip, uservar.ssh_port)
|
|
]
|
|
f.writelines(hosts_write)
|
|
except OSError as e:
|
|
print(e)
|
|
|
|
setup.setup()
|
|
os.system("just roles")
|
|
os.system("just install-all")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|