Skip to content

Instantly share code, notes, and snippets.

@fabiocerqueira
Last active December 17, 2015 01:29
Show Gist options
  • Save fabiocerqueira/5528974 to your computer and use it in GitHub Desktop.
Save fabiocerqueira/5528974 to your computer and use it in GitHub Desktop.
LAMP com Vagrant + Provy
#!/usr/bin/python
# -*- coding: utf-8 -*-
from provy.core import Role
from provy.more.debian import UserRole, PHPRole, MySQLRole, ApacheRole, GitRole, AptitudeRole
class BackEnd(Role):
def provision(self):
self.context.update({
'mysql_user': 'virtumony',
'mysql_password': 'virtumony',
'mysql_database': 'virtumony',
})
with self.using(UserRole) as role:
role.ensure_user('fabio', identified_by='omesmo', is_admin=True)
self.provision_role(GitRole)
with self.using(MySQLRole) as role:
role.ensure_user(username=self.context['mysql_user'], identified_by=self.context['mysql_password'])
role.ensure_database(self.context['mysql_database'])
self.provision_role(PHPRole)
with self.using(ApacheRole) as role:
self.execute('a2enmod rewrite', sudo=True)
role.ensure_mod('php5')
role.ensure_site_disabled('default')
with self.using(AptitudeRole) as role:
role.ensure_package_installed('php5-mysql')
role.ensure_package_installed('php5-mysqli')
role.ensure_package_installed('php5-mcrypt')
servers = {
'virtumony': {
'backend': {
'address': '33.33.33.33',
'user': 'vagrant',
'roles': [
BackEnd
]
}
}
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :hostonly, "33.33.33.33"
config.vm.share_folder "v-root", "/vagrant", ".", :owner => "www-data", :group => "www-data"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment