Fixed things

This commit is contained in:
Pünkösd Marcell 2021-11-11 18:47:19 +01:00
parent fbee178ad2
commit f67835393f
3 changed files with 18 additions and 12 deletions

View File

@ -10,11 +10,8 @@ cloud-1:
ansible_user: ubuntu
hosts:
cloud-cluster-1-master-1:
ansible_host: 192.168.110.100
cloud-cluster-1-worker-1:
ansible_host: 192.168.110.101
cloud-cluster-1-worker-2:
ansible_host: 192.168.110.102
edge-1:
@ -28,11 +25,8 @@ edge-1:
ansible_user: ubuntu
hosts:
edge-cluster-1-master-1:
ansible_host: 192.168.111.100
edge-cluster-1-worker-1:
ansible_host: 192.168.111.101
edge-cluster-1-worker-2:
ansible_host: 192.168.111.102
edge-2:
become: true
@ -47,11 +41,8 @@ edge-2:
ansible_user: ubuntu
hosts:
edge-cluster-2-master-1:
ansible_host: 192.168.112.100
edge-cluster-2-worker-1:
ansible_host: 192.168.112.101
edge-cluster-2-worker-2:
ansible_host: 192.168.112.102
site-1:
vars:
@ -64,7 +55,6 @@ site-1:
ansible_user: ubuntu
hosts:
site-emulator-1:
ansible_host: 192.168.113.100
all:
children:

View File

@ -7,7 +7,7 @@ network:
dhcp6: false
gateway4: {{ ansible_default_ipv4.gateway }}
addresses:
- "{{ ansible_host }}/24"
- "{{ ansible_default_ipv4.address }}/24"
routes:
{% for item in magic_routes %}
- to: {{ item }}

View File

@ -259,6 +259,20 @@ def run_xml(outdir:str, hostname:str, ram:int, net:str):
)
def run_ssh(outdir:str, hostname:str, ipaddr:str):
if not ipaddr:
return
sshout_file = os.path.join(outdir, 'ssh_config')
with open(sshout_file, 'at') as f:
f.write("\n".join([
f"Host {hostname}",
f"\tHostName {ipaddr}",
f"\tProxyJump luna",
"",""
]))
def main():
if len(sys.argv) < 3:
@ -270,7 +284,7 @@ def main():
img_src = sys.argv[3]
outdir = sys.argv[4]
if stage not in ['all', 'img', 'iso', 'xml']:
if stage not in ['all', 'img', 'iso', 'xml', 'ssh']:
print("Stage should be: all, img, iso or xml")
return
@ -296,6 +310,8 @@ def main():
if stage in ['xml', 'all']:
run_xml(outdir,hostname, ram, net)
if stage in ['ssh', 'all']:
run_ssh(outdir, hostname, ipaddr)
if __name__ == "__main__":
main()