def server_setup(): # Set kernel options with warn_only(): sysctl('vm.swappiness', 0) # Basic system configuration file_update('/etc/sysconfig/clock', 'ZONE=', 'ZONE="America/Chicago"') sudo('cp -f /usr/share/zoneinfo/America/Chicago /etc/localtime') # Perform updates and installs yum.update() yum.install('yum-utils', 'ntp', 'ntpdate', 'uuid', 'zsh', 'screen', 'tmux', 'vim-enhanced', 'git', 'subversion', 'bind-utils', 'telnet', 'traceroute', 'curl', 'wget') # Performs a quick time sync so all logs are accurate with warn_only(): service.enable('ntpd') service.stop('ntpd') sudo('ntpdate time.nist.gov') sudo('ntpdate tick.usno.navy.mil') service.start('ntpd') # Add custom repos for nginx, more up-to-date PHP and MySQL packages, # and a few additional PHP modules with warn_only(): yum.add_epel_repo() for repo_name, repo_rpm_url in REPO_RPMS.iteritems(): yum.add_repo_rpm(repo_rpm_url) yum.enable_repo(repo_name)
def bootstrap(): # Set kernel options print(blue('Setting sysctl options...')) with warn_only(): sysctl('vm.swappiness', 0) # Basic system configuration print(blue('Tweaking configuration...')) file_update('/etc/sysconfig/clock', 'ZONE=', 'ZONE="America/Chicago"') run('cp -f /usr/share/zoneinfo/America/Chicago /etc/localtime') # Update existing packages print(blue('Updating installed packages...')) yum.update() # Install base packages and dev tools print(blue('Installing base packages and development tools...')) yum.install('yum-utils', 'ntp', 'ntpdate', 'vim-enhanced', 'git', 'subversion', 'bind-utils', 'telnet', 'traceroute', 'curl', 'wget', 'rpm-build', 'rpmdevtools', 'spectool') yum.install_group('Development Tools') # Perform a quick time sync -- particularly good for VMs print(blue('Synchronizing system time...')) with warn_only(): service.stop('ntpd') run('ntpdate time.nist.gov') run('ntpdate tick.usno.navy.mil') service.start('ntpd') service.enable('ntpd') # Set up build user and their unprivileged environment print(blue('Creating %s user and pushing SSH key...' % build_user)) with warn_only(): sudo('useradd -m %s' % build_user) keys.push_key(user_name=build_user) sudo('chown -R %s.%s ~%s/.ssh' % (build_user, build_user, build_user)) print(blue('Setting up rpmbuild environment...')) with settings(user=build_user, warn_only=True): run('rpmdev-setuptree') run('git clone %s' % sysfm_repo) # Huzzah! print(green('CentOS build instance ready!'))
def server_setup(): # Set kernel options with warn_only(): sysctl('vm.swappiness', 0) # Perform updates and installs apt.configure() apt.upgrade() apt.install('software-properties-common', 'ntp', 'uuid', 'zsh', 'screen', 'tmux', 'vim', 'git', 'subversion', 'telnet', 'traceroute', 'curl', 'wget') # Performs a quick time sync so all logs are accurate with warn_only(): service.stop('ntp') sudo('ntpdate time.nist.gov') sudo('ntpdate tick.usno.navy.mil') service.start('ntp') service.enable('ntp')