diff tasks.py @ 326:5b88b38f2471

huge reorg, reog toplevel functions in preparation of a ui with nice task lists
author drewp@bigasterisk.com
date Mon, 20 Jan 2025 21:55:08 -0800
parents 4d1b6a6e65d2
children
line wrap: on
line diff
--- a/tasks.py	Mon Jan 20 14:10:19 2025 -0800
+++ b/tasks.py	Mon Jan 20 21:55:08 2025 -0800
@@ -1,4 +1,4 @@
-from invoke import task
+from invoke.tasks import task
 
 cmd = '''
 HOME=/root
@@ -13,41 +13,6 @@
 
 
 @task
-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 apt(ctx):
-    _run(ctx, 'apt/apt.py')
-
-
-@task
-def packages(ctx):
-    _run(ctx, 'packages.py')
-
-
-@task
-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')
 
@@ -58,31 +23,6 @@
 
 
 @task
-def wireguard(ctx):
-    _run(ctx, 'wireguard.py')
-
-
-@task
-def kube(ctx):
-    _run(ctx, 'kube.py')
-
-
-@task
-def sync(ctx):
-    _run(ctx, 'sync.py')
-
-
-@task
-def mail(ctx):
-    _run(ctx, 'mail.py')
-
-
-@task
-def home(ctx):
-    _run(ctx, 'home.py')
-
-
-@task
 def multikube(ctx):  # danger- wipes previous k3s
     from multikube_config import server_node, nodes
     ctx.run(cmd + 'inventory.py multikube_wipe.py', pty=True)
@@ -98,21 +38,28 @@
 
 @task
 def all(ctx):
-    configs = [
-        'users.py',
-        'ssh.py',
-        'system.py',
-        'apt/apt.py',
-        'packages.py',
-        'net.py',
-        'dns.py',
-        'wireguard.py',
-        'kube.py',
-        'sync.py',
-        'mail.py',
-        'home.py',
-    ]
-    ctx.run(' '.join([cmd, '--no-wait', '-y', 'inventory.py'] + configs), pty=True)
+    for opGroup in [
+            'users',
+            'system',
+            'apt',
+            'packages',
+            'net',
+            'dns',
+            'wireguard',
+            'kube',
+            'sync',
+            'mail',
+            'home',
+    ]:
+        ctx.run(
+            ' '.join([
+                cmd,  #'--no-wait',
+                '-y',
+                'inventory.py',
+                'all_operations.py'
+            ]),
+            pty=True,
+            env={'GROUP': opGroup})
     ctx.run('touch /my/proj/infra/ran_all.timestamp')