Drupalize - deploy drupal site(s) on debian with ansible from scratch

Imagine you ordered a virtual machine and you want to host your own drupal site(s) ... Umm and it should be done with one command?! Ansible is way to do it. I wouldn't talk much about ansible and how to use it in general (google is your friend), I just wanted to share my ansible-playbook.


Playbook has 4 roles:

  1. essential - copies ssh keys, configures bashrc and firewall (iptables), installs essential packages 
  2. database - installs mariadb mysql database server, creates user and database for drupal site(s)
  3. webserver - installs and configures nginx and php5-fpm package, downloads and installs drupal site with drush 
  4. memcache - installs and configures memcache

Get repo from github.com:

git clone git@github.com:vsefer/ansible-drupal.git

Run playbook:

ansible-playbook -i ',' drupalize.yml --extra-vars "domain= drupalver= dbrootpass= dbuser= dbpass= dbname="


domain - enter your domain 
drupalver - enter drupal version number ( i.e. 7.41 )
dbrootpass - enter password for user called superuser (aka root)
dbuser - enter drupal database user name
dbpass - enter drupal database user password
dbname - enter drupal database name

Drupal is installed in /srv/www/yourdomain.com/htdocs

Go to http://yourdomain.com/

Log in with user admin and password admin.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.