Skip to content

Commit

Permalink
changes to fabfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Dec 20, 2016
1 parent 0b8ecea commit 28b0385
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from fabric.api import *
from fabric.operations import put, get
from fabric.contrib.files import exists
from fabric.contrib.files import exists, append, uncomment
import os
import crypt
import datetime
import getpass

Expand All @@ -19,11 +20,11 @@ def create_user(username):
"""fab -H root@host create_user:username"""
password = getpass.getpass('password for %s> ' % username)
run('useradd -m -G www-data -s /bin/bash -p %s %s' % (crypt.crypt(password, 'salt'), username))
local('ssh-copy-id %s' % env.hosts[0])
run('cp /etc/sudoers /tmp/sudoers.new')
append('/tmp/sudoers.new', '%s ALL=(ALL) NOPASSWD:ALL' % username, use_sudo=True)
run('visudo -c -f /tmp/sudoers.new')
run('EDITOR="cp /tmp/sudoers.new" visudo')
local('ssh-copy-id %s' % env.hosts[0])
uncomment('~%s/.bashrc' % username, '#force_color_prompt=yes')

def install_web2py():
Expand Down

0 comments on commit 28b0385

Please sign in to comment.