From 9ab97f526800e093fae66292bf012c51a8c9939e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= <valtri@civ.zcu.cz> Date: Mon, 1 Mar 2021 19:52:24 +0100 Subject: [PATCH] Tune and simplify inventory file --- orchestrate.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/orchestrate.py b/orchestrate.py index 81e1866..e9b6bae 100755 --- a/orchestrate.py +++ b/orchestrate.py @@ -127,18 +127,22 @@ ff02::2 ip6-allrouters if not args.dry_run: with open('inventory', 'w') as f: f.write('''\ +[all:vars] +ansible_become=true +ansible_user=%s +ansible_ssh_common_args=\'%s -o ForwardAgent=yes -o ProxyCommand="ssh -W {{ ansible_host }}:22 -q \ +{{ ansible_user }}@%s"\' + [masters] -%s ansible_user=%s ansible_become=true ansible_host=%s ansible_ssh_common_args=\'%s\' +%s ansible_host=%s [nodes] -''' % (master_hostname, user, master_ip, args.ssh_opts)) +''' % (user, args.ssh_opts, master_ip, master_hostname, hosts[master_hostname])) for h, ip in hosts.items(): if h == master_hostname: continue f.write('\ -%s ansible_user=%s ansible_become=true ansible_host=%s ansible_ssh_common_args=\'%s \ --o ForwardAgent=yes -o ProxyCommand="ssh -W %s:22 -q %s@%s"\'\n' % (h, user, ip, args.ssh_opts, - ip, user, master_ip)) +%s ansible_host=%s \n' % (h, ip)) if component: component.action('files') -- GitLab