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

2 years ago
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')
2 years ago
#print(key)
#print(key)
file_path = os.path.dirname(os.path.realpath(__file__))
2 years ago
yml_path= "{}/inventory/host_uservar/matrix.{}".format(file_path, uservar.domain)
hosts_path = "{}/inventory/".format(file_path)
2 years ago
checks.checks()
try:
if not os.path.exists(yml_path):
os.makedirs(yml_path)
#os.mkdir(yml_path)
2 years ago
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",
2 years ago
"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)
2 years ago
setup.setup()
os.system("just roles")
os.system("just install-all")
2 years ago
if __name__ == '__main__':
main()