rut-test-ops/fabfile/__init__.py

36 lines
870 B
Python
Raw Normal View History

2013-09-02 14:01:50 +00:00
from fabric.api import run,env
2014-02-22 20:43:18 +00:00
from fabric.operations import get,put
2013-09-02 14:01:50 +00:00
import os
import yaml
import re
2014-02-22 20:43:18 +00:00
import sys
from fabfile.db import cosmos_db
2013-09-02 14:01:50 +00:00
env.user = 'root'
env.timeout = 30
env.connection_attempts = 3
env.warn_only = True
env.skip_bad_hosts = True
2014-02-22 20:43:18 +00:00
env.roledefs = cosmos_db()['members']
2013-09-02 14:01:50 +00:00
def all():
2014-02-22 20:43:18 +00:00
env.hosts = cosmos_db()['members']['all']
2013-09-02 14:01:50 +00:00
def cosmos():
2015-02-24 08:44:33 +00:00
run("/usr/local/bin/run-cosmos");
2013-09-02 14:01:50 +00:00
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))
2014-02-22 20:43:18 +00:00
def cp(local,remote):
put(local,remote)