├── .gitignore ├── LICENSE ├── README.md ├── Vagrantfile └── ansible ├── roles ├── composer │ └── tasks │ │ └── main.yml ├── curl │ └── tasks │ │ └── main.yml ├── git │ └── tasks │ │ └── main.yml ├── init │ └── tasks │ │ └── main.yml ├── memcached │ └── tasks │ │ └── main.yml ├── mongo │ ├── handlers │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── mysql │ ├── handlers │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── nginx │ ├── handlers │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── templates │ │ └── default.tpl ├── nodejs │ └── tasks │ │ └── main.yml ├── php5-cli │ └── tasks │ │ └── main.yml ├── php5-common │ ├── tasks │ │ └── main.yml │ └── templates │ │ └── extension.tpl ├── php5-fpm │ ├── handlers │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── phpunit │ └── tasks │ │ └── main.yml ├── rabbitmq │ ├── handlers │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── redis │ ├── handlers │ │ └── main.yml │ └── tasks │ │ └── main.yml ├── sqlite │ └── tasks │ │ └── main.yml └── wget │ └── tasks │ └── main.yml └── site.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | vagrant_ansible_inventory_default 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Ramon Kleiss 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | The views and conclusions contained in the software and documentation are those 25 | of the authors and should not be interpreted as representing official policies, 26 | either expressed or implied, of the FreeBSD Project. 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vagrant environment for Symfony2 2 | 3 | This project provides a virtual environment for Symfony2 development using 4 | [Vagrant](https://www.vagrantup.com). 5 | 6 | ## What's in the box? 7 | 8 | When you start Vagrant, this environment will provide the following tools 9 | that can be useful when developing for Symfony2: 10 | 11 | - Git 12 | - cURL 13 | - MySQL 14 | * Username: `root` 15 | * Password: empty 16 | - SQLite 17 | - nginx 18 | - PHP 19 | - PHP-FPM 20 | - APC 21 | - PEAR 22 | - XDebug 23 | - RabbitMQ 24 | - Memcached 25 | 26 | Additionally, it will create a MySQL database called `symfony` that a Symfony2 27 | application can connect to without any configuration. 28 | 29 | ## Usage and requirements 30 | 31 | ### Ansible 32 | 33 | [Ansible](http://ansible.com) is used to provision the virtual machine, so you 34 | must have that installed. Follow the 35 | [installation instructions](http://docs.ansible.com/intro_installation.html#installation). 36 | 37 | ### Usage 38 | 39 | Installation is as easy as cloning a GitHub project: 40 | 41 | ``` 42 | $ cd your-symfony-project 43 | $ git clone https://github.com/kleiram/vagrant-symfony.git vagrant 44 | ``` 45 | 46 | Or, if you're using Git already in your project, you can use it as a submodule: 47 | 48 | ``` 49 | $ cd your-symfony-project 50 | $ git submodule add https://github.com/kleiram/vagrant-symfony.git vagrant 51 | ``` 52 | 53 | After the project is added, you can start the environment like this: 54 | 55 | ``` 56 | $ cd vagrant 57 | $ vagrant up 58 | ``` 59 | 60 | Starting the VM might take some time, since it will download the entire box 61 | and additional applications/library. When the VM is done setting up, point 62 | your browser towards [http://192.168.33.10](http://192.168.33.10) and there you 63 | have it: Symfony2. 64 | 65 | #### Note 66 | 67 | If you're using Windows, you have to modify the `Vagrantfile` a little bit to 68 | make it all work (since Windows doesn't support NFS). Replace the following 69 | lines in the Vagrantfile: 70 | 71 | ```ruby 72 | config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => true 73 | config.vm.synced_folder "..", "/var/www", id: "application", :nfs => true 74 | ``` 75 | 76 | with: 77 | 78 | ```ruby 79 | config.vm.synced_folder ".", "/vagrant", id: "vagrant-root" 80 | config.vm.synced_folder "..", "/var/www", id: "application" 81 | ``` 82 | 83 | ## Troubleshooting 84 | 85 | ### I'm not allowed to access my site? 86 | 87 | If you visit your site and you get the following error message: 88 | 89 | ``` 90 | You are not allowed to access this file. Check app_dev.php for more information. 91 | ``` 92 | 93 | You have to remove the following lines from `web/app_dev.php`: 94 | 95 | ```php 96 | if (isset($_SERVER['HTTP_CLIENT_IP']) 97 | || isset($_SERVER['HTTP_X_FORWARDED_FOR']) 98 | || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) 99 | ) { 100 | header('HTTP/1.0 403 Forbidden'); 101 | exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); 102 | } 103 | ``` 104 | 105 | ### Why is my site so slow? 106 | 107 | If your site is noticeably slow (and I'm talking hundreds of milliseconds), it's 108 | because the caching and logging is taking it's time (NFS synchronization). One 109 | way to fix this is by changing the cache folder in the `app/AppKernel.php` file. 110 | At the end of the AppKernel class, add the following methods: 111 | 112 | ```php 113 | public function getCacheDir() 114 | { 115 | return '/tmp/symfony/cache/'. $this->environment; 116 | } 117 | 118 | public function getLogDir() 119 | { 120 | return '/tmp/symfony/log/'. $this->environment; 121 | } 122 | ``` 123 | 124 | This will change the location of the `cache` and `log` directories you normally 125 | find in the `app` directory of Symfony to the `/tmp/symfony` directory. This 126 | will speed up your site _a lot_. The downside is that you won't be able to check 127 | the log from your host computer (the computer that's running Vagrant). 128 | 129 | ## To-do 130 | 131 | The following things are additions I want to add to the project: 132 | 133 | - Node.js (with the Bower package) 134 | 135 | Feel free to add these components and create a pull request! 136 | 137 | ## Versioning 138 | 139 | This project is versioned using [Semantic Versioning](http://semver.org/spec/v1.0.0.html): 140 | 141 | ``` 142 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", 143 | "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to 144 | be interpreted as described in RFC 2119. 145 | 146 | Software using Semantic Versioning MUST declare a public API. This API could 147 | be declared in the code itself or exist strictly in documentation. However 148 | it is done, it should be precise and comprehensive. 149 | 150 | A normal version number MUST take the form X.Y.Z where X, Y, and Z are 151 | integers. X is the major version, Y is the minor version, and Z is the patch 152 | version. Each element MUST increase numerically by increments of one. For 153 | instance: 1.9.0 -> 1.10.0 -> 1.11.0. 154 | 155 | When a major version number is incremented, the minor version and patch 156 | version MUST be reset to zero. When a minor version number is incremented, 157 | the patch version MUST be reset to zero. For instance: 1.1.3 -> 2.0.0 and 158 | 2.1.7 -> 2.2.0. 159 | 160 | A pre-release version number MAY be denoted by appending an arbitrary string 161 | immediately following the patch version and a dash. The string MUST be 162 | comprised of only alphanumerics plus dash [0-9A-Za-z-]. Pre-release versions 163 | satisfy but have a lower precedence than the associated normal version. 164 | Precedence SHOULD be determined by lexicographic ASCII sort order. For 165 | instance: 1.0.0-alpha1 < 1.0.0-beta1 < 1.0.0-beta2 < 1.0.0-rc1 < 1.0.0. 166 | 167 | Once a versioned package has been released, the contents of that version 168 | MUST NOT be modified. Any modifications must be released as a new version. 169 | 170 | Major version zero (0.y.z) is for initial development. Anything may change 171 | at any time. The public API should not be considered stable. 172 | 173 | Version 1.0.0 defines the public API. The way in which the version number 174 | is incremented after this release is dependent on this public API and how 175 | it changes. 176 | 177 | Patch version Z (x.y.Z | x > 0) MUST be incremented if only backwards 178 | compatible bug fixes are introduced. A bug fix is defined as an internal 179 | change that fixes incorrect behavior. 180 | 181 | Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards 182 | compatible functionality is introduced to the public API. It MAY be 183 | incremented if substantial new functionality or improvements are introduced 184 | within the private code. It MAY include patch level changes. Patch version 185 | MUST be reset to 0 when minor version is incremented. 186 | 187 | Major version X (X.y.z | X > 0) MUST be incremented if any backwards 188 | incompatible changes are introduced to the public API. It MAY include minor 189 | and patch level changes. Patch and minor version MUST be reset to 0 when 190 | major version is incremented. 191 | ``` 192 | 193 | ## License 194 | 195 | ``` 196 | Copyright (c) 2014, Ramon Kleiss 197 | All rights reserved. 198 | 199 | Redistribution and use in source and binary forms, with or without 200 | modification, are permitted provided that the following conditions are met: 201 | 202 | 1. Redistributions of source code must retain the above copyright notice, this 203 | list of conditions and the following disclaimer. 204 | 2. Redistributions in binary form must reproduce the above copyright notice, 205 | this list of conditions and the following disclaimer in the documentation 206 | and/or other materials provided with the distribution. 207 | 208 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 209 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 210 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 211 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 212 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 213 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 214 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 215 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 216 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 217 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 218 | 219 | The views and conclusions contained in the software and documentation are those 220 | of the authors and should not be interpreted as representing official policies, 221 | either expressed or implied, of the FreeBSD Project. 222 | ``` 223 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | # Configure the box to use 3 | config.vm.box = 'precise64' 4 | config.vm.box_url = 'http://files.vagrantup.com/precise64.box' 5 | 6 | # Configure the network interfaces 7 | config.vm.network :private_network, ip: "192.168.33.10" 8 | config.vm.network :forwarded_port, guest: 80, host: 8080 9 | config.vm.network :forwarded_port, guest: 8081, host: 8081 10 | config.vm.network :forwarded_port, guest: 3306, host: 3306 11 | config.vm.network :forwarded_port, guest: 27017, host: 27017 12 | 13 | # Configure shared folders 14 | config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => true 15 | config.vm.synced_folder "..", "/var/www", id: "application", :nfs => true 16 | 17 | # Configure VirtualBox environment 18 | config.vm.provider :virtualbox do |v| 19 | v.name = (0...8).map { (65 + rand(26)).chr }.join 20 | v.customize [ "modifyvm", :id, "--memory", 512 ] 21 | end 22 | 23 | # Provision the box 24 | config.vm.provision :ansible do |ansible| 25 | ansible.extra_vars = { ansible_ssh_user: 'vagrant' } 26 | ansible.playbook = "ansible/site.yml" 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /ansible/roles/composer/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install Composer 3 | shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer 4 | -------------------------------------------------------------------------------- /ansible/roles/curl/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install cURL 3 | sudo: yes 4 | apt: pkg=curl state=latest 5 | -------------------------------------------------------------------------------- /ansible/roles/git/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install Git 3 | sudo: yes 4 | apt: pkg=git state=latest 5 | -------------------------------------------------------------------------------- /ansible/roles/init/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Update apt 3 | sudo: yes 4 | apt: update_cache=yes 5 | 6 | - name: Install system packages 7 | sudo: yes 8 | apt: pkg={{ item }} state=latest 9 | with_items: 10 | - curl 11 | - wget 12 | - build-essential 13 | - python-software-properties 14 | 15 | - name: Add ppa repository 16 | sudo: yes 17 | apt_repository: repo=ppa:ondrej/{{ php_ppa }} 18 | 19 | - name: Update apt again 20 | sudo: yes 21 | apt: update_cache=yes 22 | 23 | - name: Install extra packages 24 | sudo: yes 25 | apt: pkg={{ item }} state=latest 26 | with_items: sys_packages 27 | -------------------------------------------------------------------------------- /ansible/roles/memcached/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install Memcached 3 | sudo: yes 4 | apt: pkg=memcached state=latest 5 | -------------------------------------------------------------------------------- /ansible/roles/mongo/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart mongodb 3 | service: name=mongodb enabled=yes state=restarted 4 | -------------------------------------------------------------------------------- /ansible/roles/mongo/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install MongoDB 3 | sudo: yes 4 | apt: pkg=mongodb state=latest 5 | 6 | - name: Allow access to MongoDB from anywhere 7 | sudo: yes 8 | lineinfile: dest=/etc/mongodb.conf regexp="^bind_ip" line="#bind_ip = 127.0.0.1" 9 | notify: restart mongodb 10 | -------------------------------------------------------------------------------- /ansible/roles/mysql/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart mysql 3 | service: name=mysql enabled=yes state=restarted 4 | -------------------------------------------------------------------------------- /ansible/roles/mysql/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install MySQL server 3 | sudo: yes 4 | apt: pkg=mysql-server state=latest 5 | 6 | - name: Allow access to MySQL from anywhere 7 | sudo: yes 8 | lineinfile: dest=/etc/mysql/my.cnf regexp="^bind-address" "line=#bind-address = 0.0.0.0" 9 | notify: restart mysql 10 | 11 | - name: Add root user from anywhere to MySQL 12 | command: mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES;" 13 | 14 | - name: Create MySQL database symfony 15 | command: mysql -u root -e "CREATE DATABASE IF NOT EXISTS symfony;" 16 | -------------------------------------------------------------------------------- /ansible/roles/nginx/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart nginx 3 | service: name=nginx enabled=yes state=restarted 4 | -------------------------------------------------------------------------------- /ansible/roles/nginx/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install nginx 3 | sudo: yes 4 | apt: pkg=nginx state=latest 5 | 6 | - name: Ensure nginx log directory exists 7 | file: dest=/var/log/nginx/symfony state=directory 8 | 9 | - name: Change default nginx site 10 | sudo: yes 11 | template: src=default.tpl dest=/etc/nginx/sites-available/default 12 | notify: restart nginx 13 | 14 | -------------------------------------------------------------------------------- /ansible/roles/nginx/templates/default.tpl: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | server_name symfony; 5 | root {{ doc_root }}; 6 | 7 | error_log /var/log/nginx/symfony/error.log; 8 | access_log /var/log/nginx/symfony/access.log; 9 | 10 | rewrite ^/(app|app_dev)\.php/?(.*)$ /$1 permanent; 11 | 12 | location / { 13 | index app_dev.php; 14 | try_files $uri @rewriteapp; 15 | } 16 | 17 | location @rewriteapp { 18 | rewrite ^(.*)$ /app_dev.php/$1 last; 19 | } 20 | 21 | location ~ ^/(app|app_dev|config)\.php(/|$) { 22 | fastcgi_pass unix:/var/run/php5-fpm.sock; 23 | fastcgi_buffer_size 16k; 24 | fastcgi_buffers 4 16k; 25 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 26 | include fastcgi_params; 27 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 28 | fastcgi_param HTTPS off; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ansible/roles/nodejs/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Add ppa Repository 2 | command: bash -lc "curl -sL https://deb.nodesource.com/setup{{ nodejs.version }} | bash -" 3 | 4 | - name: Install nodeJS 5 | apt: pkg=nodejs state=present 6 | 7 | - name: Install NPM Packages 8 | npm: name={{ item }} global=yes 9 | with_items: nodejs.packages 10 | -------------------------------------------------------------------------------- /ansible/roles/php5-cli/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install PHP5-CLI 3 | sudo: yes 4 | apt: package=php5-cli state=latest 5 | -------------------------------------------------------------------------------- /ansible/roles/php5-common/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install PHP packages 3 | sudo: yes 4 | apt: package={{ item.package }} state=latest 5 | with_items: php_packages 6 | 7 | - name: Enable PHP packages 8 | sudo: yes 9 | command: /usr/sbin/php5enmod {{ item.name }} creates=/etc/php5/cli/conf.d/20-{{ item.name }}.ini 10 | with_items: php_packages 11 | notify: restart php5-fpm 12 | 13 | - name: Install PHP extensions 14 | sudo: yes 15 | shell: echo "\n" | /usr/bin/pecl install {{ item.package }} creates=/usr/lib/php5/20121212/{{ item.name }}.so 16 | with_items: php_extensions 17 | 18 | - name: Configure PHP extensions 19 | sudo: yes 20 | template: src=extension.tpl dest=/etc/php5/mods-available/{{ item.name }}.ini 21 | with_items: php_extensions 22 | 23 | - name: Enable PHP extensions 24 | sudo: yes 25 | command: /usr/sbin/php5enmod {{ item.name }} creates=/etc/php5/cli/conf.d/20-{{ item.name }}.ini 26 | with_items: php_extensions 27 | notify: restart php5-fpm 28 | -------------------------------------------------------------------------------- /ansible/roles/php5-common/templates/extension.tpl: -------------------------------------------------------------------------------- 1 | extension = {{ item.name }}.so 2 | -------------------------------------------------------------------------------- /ansible/roles/php5-fpm/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart php5-fpm 3 | service: name=php5-fpm enabled=yes state=restarted 4 | -------------------------------------------------------------------------------- /ansible/roles/php5-fpm/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install PHP5-FPM 3 | sudo: yes 4 | apt: package=php5-fpm state=latest 5 | -------------------------------------------------------------------------------- /ansible/roles/phpunit/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Download PHPUnit 3 | sudo: no 4 | command: wget https://phar.phpunit.de/phpunit.phar 5 | 6 | - name: Add executable permissions to PHPUnit 7 | sudo: no 8 | command: chmod +x phpunit.phar 9 | 10 | - name: Move PHPunit to /usr/local/bin 11 | sudo: yes 12 | command: mv phpunit.phar /usr/local/bin/phpunit -------------------------------------------------------------------------------- /ansible/roles/rabbitmq/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart rabbitmq 3 | service: name=rabbitmq-server enabled=yes state=restarted 4 | -------------------------------------------------------------------------------- /ansible/roles/rabbitmq/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Add Erlang OTP repository 3 | shell: echo 'deb http://packages.erlang-solutions.com/ubuntu precise contrib' > /etc/apt/sources.list.d/erlang.list creates=/etc/apt/sources.list.d/erlang.list 4 | 5 | - name: Download Erlang OTP key 6 | get_url: url=http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc dest=/tmp/erlang-signing-key-public.asc 7 | 8 | - name: Add Erlang OTP key 9 | sudo: yes 10 | command: apt-key add /tmp/erlang-signing-key-public.asc 11 | 12 | - name: Add RabbitMQ repository 13 | shell: echo 'deb http://www.rabbitmq.com/debian/ testing main' > /etc/apt/sources.list.d/rabbitmq.list creates=/etc/apt/sources.list.d/rabbitmq.list 14 | 15 | - name: Download RabbitMQ key 16 | get_url: url=http://www.rabbitmq.com/rabbitmq-signing-key-public.asc dest=/tmp/rabbitmq-signing-key-public.asc 17 | 18 | - name: Add RabbitMQ key 19 | sudo: yes 20 | command: apt-key add /tmp/rabbitmq-signing-key-public.asc 21 | 22 | - name: Update apt again 23 | sudo: yes 24 | apt: update_cache=yes 25 | 26 | - name: Install RabbitMQ 27 | sudo: yes 28 | apt: pkg=rabbitmq-server state=latest 29 | 30 | - name: Enable RabbitMQ plugins 31 | shell: rabbitmq-plugins enable rabbitmq_management 32 | 33 | - name: Add admin user 34 | shell: rabbitmqctl add_user admin password 35 | ignore_errors: true 36 | 37 | - name: Set admin user tags 38 | shell: rabbitmqctl set_user_tags admin administrator 39 | ignore_errors: true 40 | 41 | - name: Set admin user permissions 42 | shell: rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" 43 | ignore_errors: true 44 | 45 | - name: Delete guest user 46 | shell: rabbitmqctl delete_user guest 47 | notify: restart rabbitmq 48 | ignore_errors: true 49 | -------------------------------------------------------------------------------- /ansible/roles/redis/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart redis 3 | service: name=redis-server enabled=yes state=restarted 4 | -------------------------------------------------------------------------------- /ansible/roles/redis/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install redis 3 | sudo: yes 4 | apt: pkg=redis-server state=latest 5 | 6 | - name: Listen on all interfaces 7 | sudo: yes 8 | lineinfile: dest=/etc/redis/redis.conf regexp="^bind" "line=#bind" 9 | notify: restart redis 10 | -------------------------------------------------------------------------------- /ansible/roles/sqlite/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install SQLite 3 | sudo: yes 4 | apt: pkg=sqlite3 state=latest 5 | -------------------------------------------------------------------------------- /ansible/roles/wget/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install wget 3 | sudo: yes 4 | apt: pkg=wget state=latest 5 | -------------------------------------------------------------------------------- /ansible/site.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | sudo: true 4 | vars: 5 | doc_root: /var/www/web 6 | sys_packages: 7 | - mcrypt 8 | - vim 9 | php_packages: 10 | - { name: dev, package: php5-dev } 11 | - { name: pear, package: php-pear } 12 | - { name: xdebug, package: php5-xdebug } 13 | - { name: curl, package: php5-curl } 14 | - { name: mcrypt, package: php5-mcrypt } 15 | - { name: mysql, package: php5-mysql } 16 | - { name: redis, package: php5-redis } 17 | - { name: apc, package: php-apc } 18 | - { name: memcached, package: php5-memcached } 19 | - { name: sqlite, package: php5-sqlite } 20 | - { name: gd, package: php5-gd } 21 | php_extensions: 22 | - { name: "jsmin", package: "pecl.php.net/jsmin-beta" } 23 | - { name: "mongo", package: "pecl.php.net/mongo" } 24 | - { name: "xhprof", package: "pecl.php.net/xhprof-beta" } 25 | php_ppa: php5 26 | nodejs: 27 | version: _5.x 28 | packages: [casperjs, phantomjs, bower, gulp] 29 | roles: 30 | - init 31 | - nginx 32 | - php5-fpm 33 | - php5-cli 34 | - php5-common 35 | - composer 36 | - phpunit 37 | - mysql 38 | - mongo 39 | - git 40 | - curl 41 | - sqlite 42 | - wget 43 | - rabbitmq 44 | - redis 45 | - memcached 46 | - nodejs 47 | --------------------------------------------------------------------------------