-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- init - httpd (apache 2.4.6) - php (5.6.*) - mysql (5.5.41) - phpmyadmin (cloned latest from git repo) - removed shell scripts & some cleanup This is now fully working example!
Showing
28 changed files
with
171 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
Vagrant Centos 7 lamp using Ansible playbook | ||
========================================= | ||
|
||
This personal development VM with Ansible provisioning is rather knowledge base. 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 image from [somewhere](https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box) (thanks) | ||
I am using CentOS 7 x64 image from [somewhere](https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box) (thanks) | ||
|
||
## Prerequisites / Requirements | ||
|
||
- virtualbox | ||
- vagrant with guest additions (vagrant plugin install vagrant-vbguest) | ||
|
||
## How to run | ||
|
||
1. open terminal | ||
2. $ *cd /var/www* | ||
3. $ *mkdir project* | ||
4. $ *cd project* | ||
5. $ *git clone [email protected]:skecskes/vagrant-centos7-ansible-lamp.git* | ||
6. $ *vagrant up* | ||
7. Enjoy | ||
|
||
Your /var/www/project folder will be synced with with vagrants apache root directory. | ||
|
||
## Includes | ||
|
||
- Apache 2.4.6 | ||
- php 5.6.5 | ||
- mySql MariaDB 5.5.41 | ||
- php 5.6.* | ||
- mySql MariaDB 5.5.41 on port 3306 | ||
- phpinfo() on http://10.0.0.10 | ||
- phpmyadmin on http://10.0.0.10:9000 | ||
- phpmyadmin on http://10.0.0.10:9000 (latest version is cloned into vagrantbox) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# file: roles/playbook.yml | ||
--- | ||
- hosts: all | ||
|
||
roles: | ||
- init | ||
- httpd | ||
- php56 | ||
- mysql | ||
- phpmyadmin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# file: roles/httpd/defaults/main.yml | ||
--- | ||
|
||
# used in apache vhost configuration files | ||
doc_root: /var/www/html | ||
hostname: vagrantbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# file: roles/httpd/tasks/configure.yml | ||
|
||
- name: Change default apache vhost | ||
template: src=default.tpl dest=/etc/httpd/conf.d/000-default.conf | ||
|
||
- name: Set global ServerName for apache config | ||
lineinfile: dest=/etc/httpd/conf/httpd.conf line="ServerName localhost" | ||
|
||
- name: SELinux to enforcing | ||
command: /sbin/setenforce 0 | ||
notify: | ||
- restart httpd | ||
|
||
- name: Ensure Apache running | ||
service: name=httpd state=started enabled=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# file: roles/httpd/tasks/install.yml | ||
|
||
- name: Install Apache web server | ||
yum: pkg={{ item }} state=installed | ||
with_items: | ||
- httpd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# file: roles/httpd/tasks/main.yml | ||
|
||
- include: install.yml | ||
- include: configure.yml | ||
- include: secure.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# file: roles/httpd/tasks/secure.yml | ||
|
||
- name: Add ports 80, 443 to firewall | ||
shell: firewall-cmd --permanent --zone=public --add-service=http | ||
shell: firewall-cmd --zone=public --add-port=80/tcp --permanent | ||
shell: firewall-cmd --zone=public --add-port=443/tcp --permanent | ||
shell: firewall-cmd --reload | ||
|
||
- name: Flush iptables | ||
shell: iptables -F |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# file: roles/init/tasks/main.yml | ||
--- | ||
|
||
- name: Set up firewall | ||
shell: systemctl enable firewalld | ||
shell: systemctl start firewalld | ||
|
||
- name: Install nano, git, etc | ||
yum: pkg={{ item }} state=installed | ||
with_items: | ||
- git | ||
- nano | ||
- curl |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
roles/mysql/tasks/configure.yml → ansible/roles/mysql/tasks/configure.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# file: roles/mysql/tasks/configure.yml | ||
|
||
- name: MySQL | Add allow rule for 3306 to firewall | ||
- name: Add allow rule for 3306 to firewall | ||
firewalld: zone=public port=3306/tcp permanent=true state=enabled | ||
notify: | ||
- Restart the MySQL service |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# file: roles/php/defaults/main.yml | ||
--- | ||
|
||
composer_path: /usr/local/bin/composer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# file: roles/php/handlers/main.yml | ||
--- | ||
|
||
- name: restart iptables | ||
service: name=iptables state=restarted | ||
|
||
- name: restart httpd | ||
service: name=httpd state=restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# file: roles/php/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 }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# file: roles/php/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 | ||
|
||
- name: Install remi from remote repo | ||
yum: name=http://rpms.famillecollet.com/enterprise/remi-release-7.rpm state=present | ||
|
||
- name: upgrade all packages | ||
yum: name=* state=latest | ||
|
||
- name: Instal php | ||
yum: pkg={{ item }} enablerepo=remi,remi-php56 state=present | ||
with_items: | ||
- php | ||
- php-common | ||
|
||
- name: Instal php modules | ||
yum: pkg={{ item }} enablerepo=remi,remi-php56 state=present | ||
with_items: | ||
- php-pecl-apcu | ||
- php-cli | ||
- php-pear | ||
- php-pdo | ||
- php-mysqlnd | ||
- php-pgsql | ||
- php-pecl-mongo | ||
- php-sqlite | ||
- php-pecl-memcache | ||
- php-pecl-memcached | ||
- php-gd | ||
- php-mbstring | ||
- php-mcrypt | ||
- php-xml | ||
notify: | ||
- restart httpd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# file: roles/php/tasks/main.yml | ||
--- | ||
|
||
- include: install.yml | ||
- include: configure.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# file: roles/phpmyadmin/tasks/main.yml | ||
--- | ||
|
||
- name: Finding out if phpmyadmin is already cloned | ||
shell: test -d /var/www/phpmyadmin && echo 'exist' || echo '' | ||
register: p | ||
|
||
- name: Downloading phpmyadmin stable if isn't downloaded yet | ||
shell: cd /var/www && git clone --depth 1 -b STABLE --single-branch https://github.com/phpmyadmin/phpmyadmin.git | ||
when: p.stdout!='exist' | ||
|
||
# echo "Copy parameters.yml and create database" | ||
# cp -f /vagrant/config/symfony/parameters.yml /var/www/symfony/app/config/parameters.yml | ||
|
||
- name: Copy conf for apache | ||
template: src=phpmyadmin.tpl dest=/etc/httpd/conf.d/phpmyadmin.conf owner=root group=root mode=0644 | ||
|
||
- name: Setting firewall rules for phpmyadmin | ||
firewalld: zone=public port=9000/tcp permanent=true state=enabled | ||
|
||
- name: Flush iptables | ||
shell: iptables -F | ||
|
||
- name: Restarting httpd | ||
shell: systemctl restart httpd |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.