Skip to content

Commit

Permalink
Merge pull request #20 from heybigname/ubuntu_16.04
Browse files Browse the repository at this point in the history
Ubuntu 16.04
  • Loading branch information
mitchellvanw authored Dec 29, 2016
2 parents 536a412 + 96ee936 commit 5ee7bac
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 73 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.idea
.vagrant
.DS_Store
provision.retry
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Ansible VM 2.1
===============

This virtual machine configuration is designed to have ONE application per machine. However, it does support multiple domains / sites per configuration. This virtual machine is a particularly good fit if you run Ubuntu 14.04 LTS on your servers.
This virtual machine configuration is designed to have ONE application per machine. However, it does support multiple domains / sites per configuration. This virtual machine is a particularly good fit if you run Ubuntu 16.04 LTS on your servers.

- [Ubuntu](http://www.ubuntu.com/) 14.04 Trusty 64bit
- [NGINX](http://nginx.org/) + [PHP5-FPM](http://php-fpm.org/) _(optional)_
- [PHP](http://php.net/) 5.6 _(optional)_
- [Ubuntu](http://www.ubuntu.com/) 16.04 Xenial 64bit
- [NGINX](http://nginx.org/) + [PHP7-FPM](http://php-fpm.org/) _(optional)_
- [PHP](http://php.net/) 7.1 _(optional)_
- [Laravel Tools](http://laravel.com/) Laravel / Lumen / Envoy Tools _(optional)_
- [NodeJS](http://nodejs.org/) v0.10.29 _(optional)_
- [MailCatcher](http://mailcatcher.me/) _(optional)_
Expand Down Expand Up @@ -41,7 +41,7 @@ dbpasswd: "password"
databases: []
sites: []
php_configs: []
php_modules: ["php5-mysql", "php5-gd", "php-apc", "php5-mcrypt", "php5-curl", "php5-intl", "php5-memcached"]
php_modules: ["php7.1-mysql", "php7.1-gd", "php-apcu", "php7.1-mcrypt", "php7.1-curl", "php7.1-intl", "php-memcached"]
install_db: "no"
install_web: "no"
install_ohmyzsh: "no"
Expand Down Expand Up @@ -71,14 +71,13 @@ swap_size_in_mb: "1024"

```ruby
Vagrant.configure("2") do |config|
config.vm.box = "trusty64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.box = "ubuntu/xenial64"

config.vm.network :private_network, ip: "10.10.10.10"

config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--memory", 768]
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize ["modifyvm", :id, "--name", "CHANGE ME BEFORE USE"]
end

Expand Down Expand Up @@ -131,8 +130,7 @@ end

```ruby
Vagrant.configure("2") do |config|
config.vm.box = "trusty64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.box = "ubuntu/xenial64"

config.vm.network :private_network, ip: "10.10.10.10"

Expand Down
26 changes: 15 additions & 11 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# vagrant init ubuntu/trusty64
# vagrant init ubuntu/xenial64

Vagrant.configure("2") do |config|
config.vm.box = "trusty64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.box = "ubuntu/xenial64"

config.vm.network :private_network, ip: "10.10.10.10"

config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--memory", 768]
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize ["modifyvm", :id, "--name", "CHANGE ME BEFORE USE"]
end

config.vm.provision "shell" do |s|
s.inline = "sudo apt-get update && sudo apt-get install -y python"
end

config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/provision.yml"
ansible.extra_vars = {
Expand All @@ -22,22 +25,23 @@ Vagrant.configure("2") do |config|
sites: [
{
hostname: "app.local",
document_root: "/vagrant/site/public"
}, {
hostname: "app2.local",
document_root: "/vagrant/site2/public2"
document_root: "/vagrant/app/public"
},
{
hostname: "app-api.local",
document_root: "/vagrant/app-api/public"
}
],
php_configs: [
{ option: "upload_max_filesize", value: "100M" },
{ option: "post_max_size", value: "100M" }
],
install_gems: ["compass", "zurb-foundation"],
install_gems: [],
install_db: "yes",
install_ohmyzsh: "yes",
install_web: "yes",
install_mailcatcher: "yes",
install_hhvm: "yes",
install_mailcatcher: "no",
install_hhvm: "no",
install_beanstalkd: "no",
install_redis: "no",
install_javascript_build_system: "no",
Expand Down
6 changes: 4 additions & 2 deletions files/hosts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
127.0.0.1 localhost
127.0.1.1 trusty64
127.0.0.1 xenial64
127.0.0.1 ubuntu-xenial
127.0.0.1 {{ hostname }}

{% for host in sites %}
127.0.0.1 {{ host.hostname }}
127.0.0.1 {{ host.hostname }}
{% endfor %}

# The following lines are desirable for IPv6 capable hosts
Expand Down
2 changes: 1 addition & 1 deletion files/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
user vagrant;
user ubuntu;
worker_processes 4;
pid /run/nginx.pid;

Expand Down
2 changes: 1 addition & 1 deletion files/nginx_site.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ server {

location ~* \.php$ {
root {{ item.document_root }};
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
Expand Down
6 changes: 3 additions & 3 deletions files/php-fpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
; Relative path can also be used. They will be prefixed by:
; - the global prefix if it's been set (-p argument)
; - /usr otherwise
include=/etc/php/5.6/fpm/pool.d/*.conf
include=/etc/php/7.1/fpm/pool.d/*.conf

;;;;;;;;;;;;;;;;;;
; Global Options ;
Expand All @@ -22,14 +22,14 @@ include=/etc/php/5.6/fpm/pool.d/*.conf
; Pid file
; Note: the default prefix is /var
; Default Value: none
pid = /run/php/php5.6-fpm.pid
pid = /run/php/php7.1-fpm.pid

; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Note: the default prefix is /var
; Default Value: log/php-fpm.log
error_log = /var/log/php5.6-fpm.log
error_log = /var/log/php7.1-fpm.log

; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
Expand Down
12 changes: 6 additions & 6 deletions files/php-fpm_pool_www.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = vagrant
group = vagrant
user = ubuntu
group = ubuntu

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
Expand All @@ -35,7 +35,7 @@ group = vagrant
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php/php5.6-fpm.sock
listen = /run/php/php7.1-fpm.sock

; Set listen(2) backlog.
; Default Value: 65535 (-1 on FreeBSD and OpenBSD)
Expand All @@ -46,8 +46,8 @@ listen = /run/php/php5.6-fpm.sock
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0660
listen.owner = vagrant
listen.group = vagrant
listen.owner = ubuntu
listen.group = ubuntu
listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
Expand Down Expand Up @@ -225,7 +225,7 @@ pm.max_spare_servers = 3
; last request memory: 0
;
; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: /usr/share/php/5.6/fpm/status.html
; It's available in: /usr/share/php/7.1/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
Expand Down
22 changes: 11 additions & 11 deletions provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
databases: []
sites: []
php_modules:
- php5.6-mysql
- php5.6-gd
- php-apc
- php5.6-mcrypt
- php5.6-curl
- php5.6-intl
- php5-memcached
- php5.6-mbstring
- php5.6-dom
- php7.1-mysql
- php7.1-gd
- php-apcu
- php7.1-mcrypt
- php7.1-curl
- php7.1-intl
- php-memcached
- php7.1-mbstring
- php7.1-xml
install_db: "no"
install_web: "no"
install_ohmyzsh: "no"
Expand Down Expand Up @@ -77,7 +77,7 @@
handlers:
- name: restart nginx
service: name=nginx state=restarted
- name: restart php5.6-fpm
service: name=php5.6-fpm state=restarted
- name: restart php7.1-fpm
service: name=php7.1-fpm state=restarted
- name: restart mysql
service: name=mysql state=restarted
4 changes: 2 additions & 2 deletions tasks/mailcatcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
- name: MailCatcher | libsqlite3-dev
apt: pkg=libsqlite3-dev state=latest

- name: MailCatcher | Install Ruby 1.9.1
apt: pkg=ruby1.9.1-dev state=installed
- name: MailCatcher | Install Ruby 2.3
apt: pkg=ruby2.3 state=installed

- name: MailCatcher | Install MailCatcher
action: command gem install mailcatcher creates=/usr/local/bin/mailcatcher
Expand Down
12 changes: 4 additions & 8 deletions tasks/nginx.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
---
# NGINX

- name: NGINX | Remove Apache
apt: pkg=apache2 state=absent purge=yes

- name: NGINX | Install NGINX
apt: pkg=nginx state=installed

- name: NGINX | Copy Host Config
template: src=../files/nginx_site.conf dest=/etc/nginx/sites-available/{{ item.hostname }}.conf
template: src={{ (item.config is defined) | ternary(item.config, '../files/nginx_site.conf') }} src=../files/nginx_site.conf dest=/etc/nginx/sites-available/{{ item.hostname }}.conf
with_items: "{{sites}}"

- name: NGINX | Copy Server Config
Expand All @@ -17,11 +20,4 @@
- name: NGINX | Activate Hosts
file: src=/etc/nginx/sites-available/{{ item.hostname }}.conf dest=/etc/nginx/sites-enabled/{{ item.hostname }}.conf state=link
with_items: "{{sites}}"

- name: NGINX | Configure /etc/hosts
template: src=../files/hosts dest=/etc/hosts mode=0600
# Remove Default Apache

- name: NGINX | Remove Apache
apt: pkg=apache2 state=absent purge=yes
notify: restart nginx
2 changes: 1 addition & 1 deletion tasks/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- name: Node.js | Install Repository
apt_repository:
repo: "deb https://deb.nodesource.com/node_4.x trusty main"
repo: "deb https://deb.nodesource.com/node_7.x xenial main"
state: present
update_cache: yes

Expand Down
8 changes: 4 additions & 4 deletions tasks/ohmyzsh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
- git-core

- name: oh-my-zsh | Clone down repository
git: repo=https://github.com/robbyrussell/oh-my-zsh.git dest=/home/vagrant/.oh-my-zsh
git: repo=https://github.com/robbyrussell/oh-my-zsh.git dest=/home/ubuntu/.oh-my-zsh

- name: oh-my-zsh | Remove standard .zshrc
file: path=/home/vagrant/.zshrc state=absent
file: path=/home/ubuntu/.zshrc state=absent

- name: oh-my-zsh | Deploy new .zshrc
template: src=files/zshrc.in dest=/home/vagrant/.zshrc owner=vagrant
template: src=files/zshrc.in dest=/home/ubuntu/.zshrc owner=ubuntu

- name: oh-my-zsh | Set zsh as default shell
user: name=vagrant shell=/bin/zsh
user: name=ubuntu shell=/bin/zsh
18 changes: 9 additions & 9 deletions tasks/php-fpm.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
# PHP5-FPM
# PHP7-FPM

- name: PHP-FPM | Install PHP5-FPM
apt: pkg=php5.6-fpm state=installed
- name: PHP-FPM | Install PHP7.1-FPM
apt: pkg=php7.1-fpm state=installed

- name: PHP-FPM | Install Primary Configuration File
template: src=../files/php-fpm.conf dest=/etc/php/5.6/fpm/php-fpm.conf
template: src=../files/php-fpm.conf dest=/etc/php/7.1/fpm/php-fpm.conf

- name: PHP5-FPM | Install WWW Pool Configuration File
template: src=../files/php-fpm_pool_www.conf dest=/etc/php/5.6/fpm/pool.d/www.conf
notify: restart php5.6-fpm
- name: PHP-FPM | Install WWW Pool Configuration File
template: src=../files/php-fpm_pool_www.conf dest=/etc/php/7.1/fpm/pool.d/www.conf
notify: restart php7.1-fpm

# Update PHP.ini

- name: PHP5-FPM | Install Custom PHP.ini Configurations for FPM PHP
ini_file: dest=/etc/php/5.6/fpm/php.ini
- name: PHP-FPM | Install Custom PHP.ini Configurations for FPM PHP
ini_file: dest=/etc/php/7.1/fpm/php.ini
section=PHP
option={{ item.option }}
value={{ item.value }}
Expand Down
6 changes: 3 additions & 3 deletions tasks/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
- name: PHP | Install Ondrej PHP PPA
apt_repository: repo='ppa:ondrej/php' update_cache=yes

- name: PHP | Install PHP
apt: pkg=php5.6 state=latest
- name: PHP | Install PHP 7.1
apt: pkg=php7.1 state=latest
tags: common

- name: PHP | Install PHP Modules
Expand All @@ -25,7 +25,7 @@
# Update PHP.ini

- name: PHP | Install Custom PHP.ini Configurations for CLI PHP
ini_file: dest=/etc/php/5.6/cli/php.ini
ini_file: dest=/etc/php/7.1/cli/php.ini
section=PHP
option="{{ item.option }}"
value="{{ item.value }}"
Expand Down
6 changes: 5 additions & 1 deletion tasks/system.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
# Replace hosts
- name: System | Configure /etc/hosts
template: src=../files/hosts dest=/etc/hosts mode=0600

# Update Apt Repository

- name: System | Update Repository
Expand Down Expand Up @@ -35,7 +39,7 @@
# Ruby

- name: System | Install Ruby Development Headers
apt: pkg=ruby1.9.1-dev state=installed
apt: pkg=ruby2.3 state=installed

- name: System | Install Ruby Gems Package
apt: pkg=rubygems-integration state=installed
Expand Down

0 comments on commit 5ee7bac

Please sign in to comment.