blob: 39331045c7af549bad7a20ccd6df44da07f7605b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
from fabric.api import run,env
from fabric.operations import get,put
import os
import yaml
import re
import sys
from fabfile.db import cosmos_db
env.user = 'root'
env.timeout = 30
env.connection_attempts = 3
env.warn_only = True
env.skip_bad_hosts = True
env.roledefs = cosmos_db()['members']
def all():
env.hosts = cosmos_db()['members']['all']
def cosmos():
run("/usr/local/bin/run-cosmos -v");
def upgrade():
run("apt-get -qq update && apt-get -y -q dist-upgrade");
def facts():
get("/var/run/facts.yaml",local_path="facts/%(host)s.yaml")
def chassis():
run("ipmi-chassis --get-chassis-status")
def newvm(fqdn,ip,domain):
run("vmbuilder kvm ubuntu --domain %s --dest /var/lib/libvirt/images/%s.img --arch x86_64 --hostname %s --mem 512 --ip %s --addpkg openssh-server" % (domain,fqdn,fqdn,ip))
def cp(local,remote):
put(local,remote)
|