]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
tasks/exec: add all-roles, all-hosts keys 1645/head
authorSage Weil <sage@newdream.net>
Mon, 10 May 2021 16:13:25 +0000 (11:13 -0500)
committerSage Weil <sage@newdream.net>
Tue, 11 May 2021 16:46:32 +0000 (11:46 -0500)
'all' is ambiguous!

Signed-off-by: Sage Weil <sage@newdream.net>
teuthology/task/exec.py

index 2d38fa3b8c7bce206224df0450bfbda255be1518..b3548c332dda6b508de576b21ef40ba3e2c7477a 100644 (file)
@@ -23,6 +23,16 @@ def task(ctx, config):
     It stops and fails with the first command that does not return on success. It means
     that if the first command fails, the second won't run at all.
 
+    You can run a command on all hosts `all-hosts`, or all roles with `all-roles`:
+
+        tasks:
+        - exec:
+            all-hosts:
+              - touch /etc/passwd
+        - exec:
+            all-roles:
+              - pwd
+
     To avoid confusion it is recommended to explicitly enclose the commands in 
     double quotes. For instance if the command is false (without double quotes) it will
     be interpreted as a boolean by the YAML parser.
@@ -39,6 +49,14 @@ def task(ctx, config):
         a = config['all']
         roles = teuthology.all_roles(ctx.cluster)
         config = dict((id_, a) for id_ in roles)
+    elif 'all-roles' in config and len(config) == 1:
+        a = config['all-roles']
+        roles = teuthology.all_roles(ctx.cluster)
+        config = dict((id_, a) for id_ in roles)
+    elif 'all-hosts' in config and len(config) == 1:
+        a = config['all-hosts']
+        roles = [roles[0] for roles in ctx.cluster.remotes.values()]
+        config = dict((id_, a) for id_ in roles)
 
     for role, ls in config.items():
         (remote,) = ctx.cluster.only(role).remotes.keys()