Fabric
De Linuxmemo.
Version du 1 juillet 2012 à 19:10 par Linuxmemo (discuter | contributions)
http://docs.fabfile.org/en/1.4.2/index.html
Sommaire |
Installation
apt-get install fabric
ou bien
apt-get install python-pip pip install fabric
Commande "fab"
fab -H localhost,linuxbox fonction fab -R role fonction
fab -H localhost -f fabfile.py fonction fab -H localhost -f fabfile.py -l
Fichier de commande: "fabfile"
Variables d’environnement
abort_on_prompts all_hosts always_use_pty combine_stderr command command_prefixes connection_attempts cwd disable_known_hosts exclude_hosts fabfile host_string forward_agent host hosts keepalive key_filename linewise local_user no_agent no_keys parallel password passwords path pool_size port real_fabfile rcfile reject_unknown_hosts roledefs roles shell skip_bad_hosts ssh_config_path sudo_prefix sudo_prompt timeout use_shell use_ssh_config user version warn_only
Modèle d’exécution
Exécution en série
Exécution en parallèle
Définir une tache
Définir une lite de machines
Globale:
env.hosts = ['host1', 'host2']
Roles:
from fabric.api import env
env.roledefs = {
'web': ['www1', 'www2', 'www3'],
'dns': ['ns1', 'ns2']
}
Via la ligne de commande "fab"
fab -H host1,host2 mytask fab -R roles