Skip to content

Instantly share code, notes, and snippets.

@clarkdave
Created April 25, 2014 10:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clarkdave/11284582 to your computer and use it in GitHub Desktop.
Save clarkdave/11284582 to your computer and use it in GitHub Desktop.
(Ansible) Playbook to provision a Ubuntu VM for Prestashop, designed for vagrant
# this will provision a Ubuntu box with a basic lamp stack including a db/user for Prestashop
# it downloads Prestashop 1.5 into /tmp but doesn't install it, although you could quite easily
# extend this playbook to do that as you can run the prestashop installer via the shell
---
- hosts: all
sudo: True
tasks:
- name: apt-get update
command: apt-get update
- name: install apache2
apt: name=apache2 state=present
- name: enable mod_rewrite
command: a2enmod rewrite
- name: update apache site
template: src=templates/apache_vhost dest=/etc/apache2/sites-available/default
- name: phpinfo
template: src=templates/phpinfo.php dest=/vagrant_www/phpinfo.php
- name: set permissions on vagrant wwwroot
file: path=/vagrant_www state=directory owner=www-data group=www-data recurse=yes
- name: install php
apt: name={{ item }} state=present
with_items:
- php5
- php5-curl
- php5-mcrypt
- php5-gd
- php5-mysql
- php5-cli
notify: restart apache2
- name: install utils
apt: name={{ item }} state=present
with_items:
- curl
- wget
- vim
- imagemagick
- unzip
- name: install mysql
apt: name={{ item }} state=present
with_items:
- mysql-server
- python-mysqldb
- name: create prestashop db
mysql_db: name=prestashop state=present
- name: create prestashop db user
mysql_user: name=prestashop password=prestashop priv=prestashop.*:ALL
- name: update php.ini
template: src=templates/php.ini dest=/etc/php5/apache2/php.ini
- name: download prestashop 1.5
get_url: url=http://www.prestashop.com/download/old/prestashop_1.5.6.2.zip dest=/tmp/prestashop_1.5.6.2.zip
- name: ensure mysql is running
service: name=mysql state=started
- name: ensure apache2 is running
service: name=apache2 state=started
handlers:
- name: restart apache2
service: name=apache2 state=restarted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment