Skip to content

Commit

Permalink
added php 7.0.0 play
Browse files Browse the repository at this point in the history
some small additional fixes
  • Loading branch information
skecskes committed Dec 16, 2015
1 parent 07c1285 commit 2cb942c
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 25 deletions.
38 changes: 30 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
Vagrant Centos 7 lamp using Ansible playbook
=========================================

[![Issues](https://img.shields.io/github/issues/skecskes/vagrant-centos7-ansible-lamp.svg?style=plastic)](https://github.com/skecskes/vagrant-centos7-ansible-lamp/issues) [![Forks](https://img.shields.io/github/forks/skecskes/vagrant-centos7-ansible-lamp.svg?style=plastic)](https://github.com/skecskes/vagrant-centos7-ansible-lamp/network) [![Stars](https://img.shields.io/github/stars/skecskes/vagrant-centos7-ansible-lamp.svg?style=plastic)](https://github.com/skecskes/vagrant-centos7-ansible-lamp/stargazers) [![License](https://img.shields.io/badge/license-GPLv2-blue.svg?style=plastic)](LICENSE)
[![Issues](https://img.shields.io/github/issues/skecskes/vagrant-centos7-ansible-lamp.svg?style=plastic)](https://github.com/skecskes/vagrant-centos7-ansible-lamp/issues)
[![Forks](https://img.shields.io/github/forks/skecskes/vagrant-centos7-ansible-lamp.svg?style=plastic)](https://github.com/skecskes/vagrant-centos7-ansible-lamp/network)
[![Stars](https://img.shields.io/github/stars/skecskes/vagrant-centos7-ansible-lamp.svg?style=plastic)](https://github.com/skecskes/vagrant-centos7-ansible-lamp/stargazers)
[![License](https://img.shields.io/badge/license-GPLv2-blue.svg?style=plastic)](LICENSE)


This personal development VM with Ansible provisioning is **fully working example**. I created this VM in order to have a proper php testbed for my php applications. After vagrant up, the main url will welcome you with phpinfo(). I hope you will enjoy this VM and I always accept recommendations and requests.
This personal development VM with Ansible provisioning is **fully working example**. I created this VM in order to
have a proper php testbed for my php applications. After vagrant up, the main url will welcome you with phpinfo().
I hope you will enjoy this VM and I always accept recommendations and requests.

## Guest OS

I am using CentOS 7 x64 image from [somewhere](https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box) (thanks)
I am using the lastest CentOS 7 x64 image from official [Hashicorp](https://atlas.hashicorp.com/centos/7) (thanks)

## Prerequisites / Requirements

- virtualbox
- vagrant with guest additions (vagrant plugin install vagrant-vbguest)
- [Virtualbox platform](https://www.virtualbox.org/wiki/Downloads)
- [Vagrant](https://docs.vagrantup.com/v2/installation/)
- guest additions to Vagrant `vagrant plugin install vagrant-vbguest`
- [Git]()

## How to run

Create your new folder for your project. Clone this repository into that folder, which will download all configuration
needed to run vagrant machine. Then just run `vagrant up` in terminal and the rest will be done automatically.

Note, that if you run it first time, vagrant will download the guest OS (414 MB of Centos 7 in this case) box
from internet, which in my case took 8 minutes and will save it locally so that you can use it later.

1. open terminal
2. $ *cd /var/www*
3. $ *mkdir project*
Expand All @@ -27,10 +40,19 @@ I am using CentOS 7 x64 image from [somewhere](https://f0fff3908f081cb6461b407be

Your /var/www/project folder will be synced with with vagrants apache root directory.

## Includes
## What is included

### Tag 1.0

- Apache 2.4.6
- php 5.6.*
- mySql MariaDB 5.5.41 on port 3306
- latest php 5.6.*
- latest mySQL MariaDB 5.5.* on port 3306 (user: root, pass: toor)
- phpinfo() on http://10.0.0.10
- phpmyadmin on http://10.0.0.10:9000 (latest version is cloned into vagrantbox)


### Tag 2.0

Same as previous, but latest PHP 7.0.* (php7) is used

![php7](ansible/roles/php70/php7.png)
7 changes: 4 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos-7"
config.vm.box_url = "https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box"
config.vm.box = "centos/7"
config.vm.hostname = "vagrantbox"

config.vm.network :forwarded_port, host: 80, guest: 80, auto_correct: true # website
config.vm.network :forwarded_port, guest: 443, host: 443, auto_correct: true # ssl
config.vm.network :forwarded_port, guest: 3306, host: 3306, auto_correct: true # mysql
config.vm.network :forwarded_port, guest: 9000, host: 9000, auto_correct: true # phpmyadmin
config.vm.network :private_network, ip: "10.0.0.10"
config.vm.synced_folder "./", "/var/www/html", id: "vagrant", :nfs => false, :mount_options => ["dmode=777", "fmode=666"]
config.vm.synced_folder "./", "/var/www/html", type: "rsync", id: "vagrant", :nfs => false,
:mount_options => ["dmode=777", "fmode=666"]

config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.customize ['modifyvm', :id, '--memory', '1024']
vb.customize ["modifyvm", :id, "--cpus", "1"]
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
Expand Down
5 changes: 3 additions & 2 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# file: roles/playbook.yml
# file: ansible/playbook.yml
---
- hosts: all

roles:
- init
- httpd
- php56
#- php56
- php70
- mysql
- phpmyadmin
5 changes: 5 additions & 0 deletions ansible/roles/httpd/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# file: roles/httpd/handlers/main.yml
---

- name: restart httpd
service: name=httpd state=restarted
5 changes: 5 additions & 0 deletions ansible/roles/init/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# file: roles/php56/handlers/main.yml
---

- name: restart iptables
service: name=iptables state=restarted
11 changes: 10 additions & 1 deletion ansible/roles/init/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@
shell: systemctl enable firewalld
shell: systemctl start firewalld

- name: Update Yum
yum: name=* state=latest

- name: Install nano, git, etc
yum: pkg={{ item }} state=installed
with_items:
- git
- nano
- curl
- curl
- gcc
- kernel-devel
- wget
- vim
- man
- unzip
2 changes: 1 addition & 1 deletion ansible/roles/php56/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# file: roles/php/defaults/main.yml
# file: roles/php56/defaults/main.yml
---

composer_path: /usr/local/bin/composer
7 changes: 2 additions & 5 deletions ansible/roles/php56/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# file: roles/php/handlers/main.yml
# file: roles/php56/handlers/main.yml
---

- name: restart iptables
service: name=iptables state=restarted

- name: restart httpd
service: name=httpd state=restarted

2 changes: 1 addition & 1 deletion ansible/roles/php56/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# file: roles/php/tasks/configure.yml
# file: roles/php56/tasks/configure.yml

- name: Install Composer globally
shell: curl -sS https://getcomposer.org/installer | /usr/bin/php && /bin/mv -f composer.phar {{ composer_path }} creates={{ composer_path }}
Expand Down
6 changes: 3 additions & 3 deletions ansible/roles/php56/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# file: roles/php/tasks/install.yml
# file: roles/php56/tasks/install.yml

- name: Install epel from remote repo
yum: name=http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm state=present
Expand All @@ -9,13 +9,13 @@
- name: upgrade all packages
yum: name=* state=latest

- name: Instal php
- name: Install php
yum: pkg={{ item }} enablerepo=remi,remi-php56 state=present
with_items:
- php
- php-common

- name: Instal php modules
- name: Install php modules
yum: pkg={{ item }} enablerepo=remi,remi-php56 state=present
with_items:
- php-pecl-apcu
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/php56/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# file: roles/php/tasks/main.yml
# file: roles/php56/tasks/main.yml
---

- include: install.yml
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/php70/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# file: roles/php70/defaults/main.yml
---

composer_path: /usr/local/bin/composer
8 changes: 8 additions & 0 deletions ansible/roles/php70/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# file: roles/php70/handlers/main.yml
---

- name: restart iptables
service: name=iptables state=restarted

- name: restart httpd
service: name=httpd state=restarted
Binary file added ansible/roles/php70/php7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions ansible/roles/php70/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# file: roles/php70/tasks/configure.yml

- name: Install Composer globally
shell: curl -sS https://getcomposer.org/installer | /usr/bin/php && /bin/mv -f composer.phar {{ composer_path }} creates={{ composer_path }}

31 changes: 31 additions & 0 deletions ansible/roles/php70/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# file: roles/php70/tasks/install.yml

- name: Install epel from remote repo
yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm state=present

- name: Install remi from remote repo
yum: name=http://rpms.remirepo.net/enterprise/remi-release-7.rpm state=present

- name: upgrade all packages
yum: name=* state=latest

- name: Install php
yum: pkg={{ item }} enablerepo=remi,remi-php70 state=present
with_items:
- php

- name: Install php modules
yum: pkg={{ item }} enablerepo=remi,remi-php70 state=present
with_items:
- php-mbstring
- php-devel
- php-opcache
- php-soap
- php-pdo
- php-mcrypt
- php-pecl-xdebug
- php-xml
- php-mysql
- php-gd
notify:
- restart httpd
5 changes: 5 additions & 0 deletions ansible/roles/php70/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# file: roles/php70/tasks/main.yml
---

- include: install.yml
- include: configure.yml

0 comments on commit 2cb942c

Please sign in to comment.