def timezone(timezone=config.get("ntp_client", {}).get("ntp_timezone", "Asia/Calcutta")): """ Set the timezone. """ if not is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return import apt apt.ensure(tzdata="latest") return run("cp -f /usr/share/zoneinfo/%s /etc/localtime" % timezone)
def deploy(): """ Install and configure and start cups client. """ if not is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return import apt, service packages = {"cupsys":"latest", "cups-client":"latest"} apt.ensure(**packages) configure() service.ensure(cupsys="restarted")
def sync(musthavelatest=config.get("pkgsync", {}).get("musthavelatest", ""), musthave=config.get("pkgsync", {}).get("musthave", ""), mayhave=config.get("pkgsync", {}).get("mayhave", ""), maynothave=config.get("pkgsync", {}).get("maynothave", "")): """ Sync a system's packages with a pre-defined manifest. The ``mayhave`` list currently gets ignored. """ pkgspec = {} if os.path.isfile(musthavelatest): pkgspec.update(generate_package_list(musthavelatest, "latest")) if os.path.isfile(musthave): pkgspec.update(generate_package_list(musthave, "installed")) if os.path.isfile(maynothave): pkgspec.update(generate_package_list(maynothave, "removed")) if len(pkgspec) == 0: print yellow("No packages specified") return import apt ok, fail = apt.ensure(**pkgspec) if fail == 0: print green("%s: %d packages sync'ed." % (env.host, ok)) elif ok == 0: print red("%s: %d packages failed to sync." % (env.host, fail)) else: print yellow("%s: %d packages sync'd and %d packages failed" % (env.host, ok, fail))
def deploy(): """ Install, configure and start snmpd. """ if not is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return import apt, service packages = {"snmpd":"latest"} if run("cat /etc/issue").find("6.0") > -1: # its debian 6 packages["snmp-mibs-downloader"] = "installed" apt.ensure(**packages) configure() service.ensure(snmpd="restarted")
def deploy(server=config.get("ntp_client", {}).get("ntp_server", "")): """ Install, configure and start ntp sync and timezone. """ if not is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return import apt, service packages = {"ntp":"latest", "ntpdate":"latest"} apt.ensure(**packages) configure() # Sync with server run("ntpdate %s" % server) # Sync hardware clock to correct time run("hwclock --systohc") service.ensure(ntp="restarted") timezone()
def deploy(server=config.get("ntp_client", {}).get("ntp_server", "")): """ Install, configure and start ntp sync and timezone. """ if not is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return import apt, service packages = {"ntp": "latest", "ntpdate": "latest"} apt.ensure(**packages) configure() # Sync with server run("ntpdate %s" % server) # Sync hardware clock to correct time run("hwclock --systohc") service.ensure(ntp="restarted") timezone()
def deploy(): """ Install, configure and start webmin. """ if not utils.is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return # Check if webmin is installed installed, upgradeable = apt.status("webmin") if not installed: packages = { "libnet-ssleay-perl":"latest", "libauthen-pam-perl":"latest", "libio-pty-perl":"latest", "libmd5-perl":"latest" } apt.ensure(**packages) download() install() service.ensure(webmin="running")