|
From: | Comete |
Subject: | [Fab-user] running a different command for each host in one task |
Date: | Thu, 10 May 2012 12:24:41 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
Hi,i would like to define one unique task in which i could run a different command on 2 or more hosts.
For example: @hosts('host1') def ask_fw(keyword): """Interroge la greylist du firewall""" print(green('Vérification de la greylist sur le firewall:')) run('spamdb | grep %s' % keyword) @hosts('host2') def ask_smtp(keyword): """Interroge le maillog de la passerelle SMTP""" print(green('Vérification des logs de la passerelle smtp:')) sudo('zgrep %s /var/log/maillog*' % keyword) @task def is_it_blocked(): """Verifie si un mail est bloqué sur firewall ou la passerelle SMTP""" address = raw_input("Entrez l'adresse ou mot clé à rechercher: ") ask_fw(address) ask_smtp(address) This example doesn't work but is it possible to do something similar ? Thanks a lot. Morgan
[Prev in Thread] | Current Thread | [Next in Thread] |