Skip to content

Instantly share code, notes, and snippets.

@diogobaeder
Created September 14, 2012 03:35
Show Gist options
  • Save diogobaeder/3719645 to your computer and use it in GitHub Desktop.
Save diogobaeder/3719645 to your computer and use it in GitHub Desktop.
class UbuntuServer(Role):
def provision(self):
self.log('Starting provisioning for Cumbuca Chic...')
self._check_user()
self._setup_postgres()
self._install_deb_packages()
self._install_python_packages()
self.log('Finished provisioning for Cumbuca Chic')
def _check_user(self):
with self.using(UserRole) as role:
role.ensure_user(env.get('remote_username'), identified_by=env.get('remote_password'))
def _install_deb_packages(self):
with self.using(AptitudeRole) as role:
for package in DEB_PACKAGES:
role.ensure_package_installed(package)
def _install_python_packages(self):
self.provision_role(PipRole)
with self.using(PipRole) as pip, self.using(VirtualenvRole) as venv, venv('cumbucachic'):
pip.use_sudo = False
self.execute('easy_install distribute')
pip.ensure_requeriments_installed('requirements.txt')
def _setup_postgres(self):
with self.using(PostgreSQLRole) as role:
role.ensure_user(env.get('database_user'))
role.ensure_database(env.get('database_name'), owner=env.get('database_user'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment