コード例 #1
0
ファイル: operations.py プロジェクト: hivesolutions/remotia
def upgrade(hostname):
    ssh = deployers.get_ssh(hostname)
    deployers.print_host(hostname, "system upgrading...")
    deployers.update_apt(ssh)
    deployers.print_host(hostname, "system upgraded")
    deployers.reboot(ssh)
    deployers.print_host(hostname, "reboot order sent")
コード例 #2
0
ファイル: omni.py プロジェクト: hivesolutions/remotia
def omni_deploy(hostname, local_path = None):
    ssh = deployers.get_ssh(hostname)
    deployers.print_host(hostname, "deploying mysql...")
    db.mysql_deploy(hostname)
    deployers.print_host(hostname, "deployed mysql")
    deployers.print_host(hostname, "setting users...")
    deployers.mysql_add_user(ssh, config.OMNI_DB_USERNAME, config.OMNI_DB_PASSWORD)
    deployers.print_host(hostname, "transferring file...")
    deployers.put(ssh, local_path, "/tmp/omni_deploy.tar.gz", remove = False)
    deployers.print_host(hostname, "creating '%s' database..." % config.OMNI_DB_NAME)
    deployers.mysql_create_database(
        ssh,
        config.OMNI_DB_NAME,
        username = config.OMNI_DB_USERNAME,
        password = config.OMNI_DB_PASSWORD
    )
    deployers.print_host(hostname, "created database")
    deployers.print_host(hostname, "loading database...")
    deployers.mysql_load(
        ssh,
        database = config.OMNI_DB_NAME,
        path = "/tmp/omni_deploy.tar.gz",
        username = config.OMNI_DB_USERNAME,
        password = config.OMNI_DB_PASSWORD
    )
    deployers.print_host(hostname, "loaded database")
    deployers.print_host(hostname, "removing temporary files...")
    deployers.rm(ssh, "/tmp/omni_deploy.tar")
    deployers.rm(ssh, "/tmp/omni_deploy.tar.gz")
    deployers.print_host(hostname, "removed temporary files")
コード例 #3
0
ファイル: consulting.py プロジェクト: hivesolutions/remotia
def cleermob_backup(hostname):
    date_s = deployers.get_date_s()
    file_name = "cleermob_%s.sql.gz" % date_s
    cleermob_path = os.path.join(config.BACKUPS_PATH, "cleermob")
    local_path = os.path.join(cleermob_path, file_name)
    if not os.path.exists(cleermob_path): os.makedirs(cleermob_path)

    ssh = deployers.get_ssh(hostname)
    deployers.print_host(hostname, "dumping database...")
    remote_path = deployers.mysql_dump(
        ssh,
        database = config.CLEER_DB_NAME,
        username = config.CLEER_DB_USERNAME,
        password = config.CLEER_DB_PASSWORD
    )
    deployers.print_host(hostname, "dumped database")
    deployers.print_host(hostname, "transferring file...")
    deployers.get(ssh, remote_path, local_path, remove = True)
    deployers.print_host(hostname, "file transfered")
コード例 #4
0
ファイル: operations.py プロジェクト: hivesolutions/remotia
def service_update(hostname):
    """
    Runs a series of typical service update operations in the
    range of servers for the hive infra-structure.

    These operations are safe to be run in any occasion as they
    do not create any data destruction or change.

    @type hostname: String
    @param hostname: The name of the host to be used for this
    operation, this should be a fully qualified name.
    """

    ssh = deployers.get_ssh(hostname)
    uptime_s = deployers.uptime(ssh)
    deployers.print_host(hostname, uptime_s)

    dns_update(hostname)
    dhcp_update(hostname)
    apt_update(hostname)
コード例 #5
0
ファイル: operations.py プロジェクト: hivesolutions/remotia
def init(hostname):
    """
    Initializes the system, creating a series of files that
    may be required for a series of base operations.

    This script is recommended for every setup of a machine
    running under the current infrastructure.

    @type hostname: String
    @param hostname: The name of the host to be used for this
    operation, this should be a fully qualified name.
    """

    ssh = deployers.get_ssh(hostname)
    deployers.print_host(hostname, "deploying the ssh keys...")
    deployers.deploy_keys(ssh)
    deployers.print_host(hostname, "finished deploying the ssh keys")
    deployers.print_host(hostname, "creating users")
    deployers.create_users(ssh, config.USERS)
    deployers.print_host(hostname, "finished creating users...")
コード例 #6
0
ファイル: operations.py プロジェクト: hivesolutions/remotia
def apt_update(hostname):
    ssh = deployers.get_ssh(hostname)
    deployers.print_host(hostname, "upgrading software...")
    deployers.update_apt(ssh)
    deployers.print_host(hostname, "software upgraded")
コード例 #7
0
ファイル: operations.py プロジェクト: hivesolutions/remotia
def dhcp_update(hostname):
    ssh = deployers.get_ssh(hostname)
    if not hostname in config.DHCP_SERVERS: return
    config_v = config.DHCP_CONFIG.get(hostname, {})
    deployers.update_dhcp(ssh, **config_v)
    deployers.print_host(hostname, "updated dhcp registers")
コード例 #8
0
ファイル: operations.py プロジェクト: hivesolutions/remotia
def dns_update(hostname):
    ssh = deployers.get_ssh(hostname)
    if not hostname in config.DNS_SERVERS: return
    config_v = config.DNS_CONFIG.get(hostname, {})
    deployers.update_dns(ssh, **config_v)
    deployers.print_host(hostname, "updated dns registers")
コード例 #9
0
ファイル: operations.py プロジェクト: hivesolutions/remotia
def reboot(hostname):
    ssh = deployers.get_ssh(hostname)
    deployers.reboot(ssh)
    deployers.print_host(hostname, "reboot order sent")
コード例 #10
0
ファイル: db.py プロジェクト: hivesolutions/remotia
def mysql_deploy(hostname, username = None, password = None, bind = "0.0.0.0"):
    ssh = deployers.get_ssh(hostname)
    deployers.install_apt(ssh, "mysql-server")
    deployers.mysql_open(ssh, bind)
    username and password and deployers.mysql_add_user(ssh, username, password)
    deployers.restart_service(ssh, "mysql")