def configure(**kwargs): """ Configure NTP sync to server. """ # Upload configuration params = copy.copy(config.get("cups_client", {})) params.update(**kwargs) reconfigure("cups_client.conf.template", params, CUPS_CONF_PATH)
def configure(): """ Set the locale to be: en_IN UTF-8 en_US ISO-8859-1 en_US.UTF-8 UTF-8 """ reconfigure("locale.template", {}, "/etc/locale.gen") run("/usr/sbin/locale-gen")
def configure(server=config.get("ntp_client", {}).get("ntp_server", "")): """ Configure NTP sync to server. """ if not is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return # Upload configuration params = {'server':server} reconfigure("ntp_client.conf.template", params, NTP_CONF_PATH)
def configure(server=config.get("ntp_client", {}).get("ntp_server", "")): """ Configure NTP sync to server. """ if not is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return # Upload configuration params = {'server': server} reconfigure("ntp_client.conf.template", params, NTP_CONF_PATH)
def configure(**kwargs): """ Configure SNMP on the server. """ if not is_debian_or_ubuntu(): print red("Cannot deploy to non-debian/ubuntu host: %s" % env.host) return params = copy.copy(config['snmp']) params.update(kwargs) reconfigure("snmpd.conf.template", params, SNMPD_CONF_PATH) reconfigure("snmpd.template", params, SNMPD_PATH)
def deploy(server=config.get("apt", {}).get("apt_proxy_server", ""), port=config.get("apt", {}).get("apt_proxy_port", "")): """ Direct each host to use an apt proxy (approx/apt-proxy/apt-cacher-ng). """ params = {'server':server, 'port':port} reconfigure("apt_02proxy.template", params, APT_PROXY_PATH) # Only copy sources.list if we are using debian 6.0 if run("cat /etc/issue").find("6.0") > -1: # its debian 6 reconfigure("apt_sources.list6.0.template", {}, APT_SOURCES_PATH) print yellow("Debian 6.0 found - standardizing %s" % APT_SOURCES_PATH) run("apt-get update")
def deploy(server=config.get("apt", {}).get("apt_proxy_server", ""), port=config.get("apt", {}).get("apt_proxy_port", "")): """ Direct each host to use an apt proxy (approx/apt-proxy/apt-cacher-ng). """ params = {'server': server, 'port': port} reconfigure("apt_02proxy.template", params, APT_PROXY_PATH) # Only copy sources.list if we are using debian 6.0 if run("cat /etc/issue").find("6.0") > -1: # its debian 6 reconfigure("apt_sources.list6.0.template", {}, APT_SOURCES_PATH) print yellow("Debian 6.0 found - standardizing %s" % APT_SOURCES_PATH) run("apt-get update")
def disabled(**kwargs): """ Ensure nginx web proxying to a sub-domain is disabled """ if len(kwargs) < 1: usage() changed = False for sub, url in kwargs.iteritems(): template = "web_nginx.template" if url.lower().startswith("https:"): template = "web_ssl_nginx.template" params = {} params.update(config.get("web", {})) params['sub'] = sub params['url'] = url # reconfiguration doesn't matter in this case reconfigure(template, params, "/etc/nginx/sites-available/%s" % sub) if exists("/etc/nginx/sites-enabled/%s" % sub): changed = True run("rm /etc/nginx/sites-enabled/%s" % sub) if changed: import service service.ensure(nginx="restarted")