示例#1
0
def create_user():
    with settings(user='root'):
        cuisine.user_ensure('ssmjp')
        append('/etc/sudoers', 'ssmjp ALL=(ALL) ALL')
        cuisine.ssh_authorize('ssmjp', cuisine.file_local_read('~/.ssh/ssmjp.pub'))
        conf = Pit.get('ssmjp-user', { 'require': { 'password': 'Your password' } })
        cuisine.user_passwd('ssmjp', conf['password'])
示例#2
0
def setup_os():
	with cuisine.mode_sudo():
		cuisine.ssh_authorize( "matze" , cuisine.file_local_read("./cuisine_id.pub"))
		for _ in PACKAGE_ENSURE: cuisine.package_ensure(_)
		cuisine.run("a2enmod rewrite")
		# TODO enable   AllowOverride none => all for /var/www
		cuisine.run("service apache2 restart")
示例#3
0
def install_nginx_upstart(version):
    """Install nginx upstart config."""

    install_dir = os.path.join(_INSTALL_DIR, 'nginx', version)
    nginx_bin = os.path.join(install_dir, 'sbin', 'nginx')
    nginx_pid = os.path.join(install_dir, 'logs', 'nginx.pid')

    context = {
        'nginx_bin': nginx_bin,
        'nginx_pid': nginx_pid,
    }

    nginx_tpl = os.path.join(ETC_DIR, 'init', 'nginx.conf')
    tpl_content = file_local_read(nginx_tpl)
    content = text_template(tpl_content, context)

    with mode_sudo():
        file_write('/etc/init/nginx.conf', content)
示例#4
0
def setup_dokuwiki():
	if not cuisine.file_exists('/tmp/dokuwiki-stable.tgz'):
		cuisine.cd("/tmp")
		cuisine.run( " wget -c http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz")
	if not cuisine.dir_exists('/tmp/dokuwiki-20*'):
		cuisine.cd( "/tmp" )   
		cuisine.run("tar xvzf dokuwiki-stable.tgz"); 
	
	## Improve for update purpose
	#if not cuisine.dir_exists( www_folder + "/dokuwiki" ):
	if True:
		cuisine.log_message("Installing")
		with cuisine.mode_sudo():
			cuisine.dir_ensure( www_folder + "/dokuwiki" )
			cuisine.run("cp -rv /tmp/dokuwiki-20*/* " + www_folder + "/dokuwiki" )
			for _ in ( 'data', 'conf' , 'bin' , 'inc'):
				cuisine.file_write( www_folder + "/dokuwiki" + "/" +  _ + "/.htaccess" , cuisine.file_local_read("./htaccess_template") , owner=http_user , group=http_user)
			cuisine.dir_ensure( www_folder + "/dokuwiki", owner=http_user , group=http_user , recursive=True  )

	print "now visit <IP>/dokuwiki/install.php"	
示例#5
0
def setup_ssh():
    puts(fabric.colors.green('[Install SSH Publickey]', True))

    with cuisine.mode_sudo():
        cuisine.ssh_authorize("pi", cuisine.file_local_read('~/.ssh/id_rsa.pub'))