Mercurial > code > home > repos > infra
changeset 139:105b628e3bfa
compact/dry
author | drewp@bigasterisk.com |
---|---|
date | Tue, 10 Jan 2023 10:53:32 -0800 |
parents | 5558d8481ddf |
children | ebb2c4651886 |
files | tasks.py |
diffstat | 1 files changed, 27 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/tasks.py Tue Jan 10 10:52:55 2023 -0800 +++ b/tasks.py Tue Jan 10 10:53:32 2023 -0800 @@ -7,80 +7,54 @@ cd /my/proj/infra env/bin/pyinfra ''' - -@task -def users(ctx): - ctx.run(cmd + 'inventory.py users.py', pty=True) - - -@task -def ssh(ctx): - ctx.run(cmd + 'inventory.py ssh.py', pty=True) - - -@task -def system(ctx): - ctx.run(cmd + 'inventory.py system.py', pty=True) - - -@task -def packages(ctx): - ctx.run(cmd + 'inventory.py packages.py', pty=True) - - -@task -def net(ctx): - ctx.run(cmd + 'inventory.py net.py', pty=True) - - -@task -def dns(ctx): - ctx.run(cmd + 'inventory.py dns.py', pty=True) - - -@task -def dns_check(ctx): - ctx.run(cmd + 'inventory.py dns_check.py -v', pty=True) +def _run(ctx, s): + ctx.run(cmd + 'inventory.py %s' % s, pty=True, echo=True) @task -def dns_k8s_check(ctx): - ctx.run('env/bin/python dns_k8s_check.py', pty=True) +def users(ctx): _run(ctx, 'users.py') +@task +def ssh(ctx): _run(ctx, 'ssh.py') + +@task +def system(ctx): _run(ctx, ' system.py') @task -def wireguard(ctx): - ctx.run(cmd + 'inventory.py wireguard.py', pty=True) - +def packages(ctx): _run(ctx, ' packages.py') @task -def kube(ctx): - ctx.run(cmd + 'inventory.py kube.py ', pty=True) +def net(ctx): _run(ctx, 'net.py') +@task +def dns(ctx): _run(ctx, 'dns.py') + +@task +def dns_check(ctx): _run(ctx, 'dns_check.py -v') @task -def kube_bang(ctx): - ctx.run(cmd + 'inventory.py kube.py --limit bang', pty=True) - +def dns_k8s_check(ctx): ctx.run('env/bin/python dns_k8s_check.py', pty=True) @task -def sync(ctx): - ctx.run(cmd + 'inventory.py sync.py ', pty=True) +def wireguard(ctx): _run(ctx, 'wireguard.py') +@task +def kube(ctx): _run(ctx, 'kube.py') @task -def mail(ctx): - ctx.run(cmd + 'inventory.py mail.py ', pty=True) +def kube_bang(ctx): _run(ctx, 'kube.py --limit bang') +@task +def sync(ctx): _run(ctx, 'sync.py') @task -def home(ctx): - ctx.run(cmd + 'inventory.py home.py', pty=True) - +def mail(ctx): _run(ctx, 'mail.py') @task -def pipe(ctx): - ctx.run(cmd + 'inventory.py pipe.py --limit pipe', pty=True) +def home(ctx): _run(ctx, 'home.py') + +@task +def pipe(ctx): ctx.run(cmd + 'inventory.py pipe.py --limit pipe', pty=True) @task def multikube(ctx): # danger- wipes previous k3s