Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 78c1867

Browse files
author
Jamie Snape
committed
Update provisioning scripts
1 parent d7ab13c commit 78c1867

File tree

29 files changed

+2145
-221
lines changed

29 files changed

+2145
-221
lines changed

Vagrantfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
23
#=============================================================================
34
# Midas Server
45
# Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France.
@@ -18,11 +19,17 @@
1819
# limitations under the License.
1920
#=============================================================================
2021

21-
Vagrant.configure("2") do |config|
22-
config.vm.box = "ubuntu/trusty64"
23-
config.vm.network "forwarded_port", guest: 80, host: 8080
24-
config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"
25-
config.vm.provision "ansible" do |ansible|
26-
ansible.playbook = "provisioning/ansible/site.yml"
22+
Vagrant.configure('2') do |config|
23+
if Vagrant.has_plugin?('vagrant-cachier')
24+
config.cache.auto_detect = false
25+
config.cache.enable :apt
26+
config.cache.enable :apt_lists
27+
config.cache.enable :composer
28+
config.cache.scope = :box
29+
end
30+
config.vm.box = 'ubuntu/trusty64'
31+
config.vm.network 'forwarded_port', guest: 80, host: 8080, auto_correct: true
32+
config.vm.provision 'ansible' do |ansible|
33+
ansible.playbook = 'provisioning/ansible/site.yml'
2734
end
2835
end

provisioning/ansible/roles/apache2/handlers/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

2020
---
2121
- name: restart apache2
22-
service: name=apache2 state=restarted
22+
service: name={{ apache2_service }} state=restarted

provisioning/ansible/roles/apache2/tasks/main.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,56 @@
1818
#=============================================================================
1919

2020
---
21+
- name: include vars
22+
include_vars: "{{ item }}"
23+
with_first_found:
24+
- "{{ ansible_distribution | lower }}.yml"
25+
- "{{ ansible_os_family | lower }}.yml"
26+
- default.yml
27+
2128
- name: apt install
2229
apt: name={{ item }} state=present
2330
with_items:
2431
- apache2
25-
- php5
26-
- php5-gd
2732
- sendmail
33+
when: ansible_pkg_mgr == 'apt'
2834

29-
- name: php.ini
30-
template: src=etc-php5-apache2-php.ini.j2 dest=/etc/php5/apache2/php.ini
31-
notify:
32-
- restart apache2
33-
34-
- name: enable modules
35-
apache2_module: name={{ item }} state=present
35+
- name: yum install
36+
yum: name={{ item }} state=present
3637
with_items:
37-
- rewrite
38-
- vhost_alias
38+
- httpd
39+
- sendmail
40+
when: ansible_pkg_mgr == 'yum'
41+
42+
- name: enable rewrite module
43+
apache2_module: name=rewrite state=present
3944
notify:
4045
- restart apache2
46+
when: ansible_os_family == 'Debian'
4147

42-
- name: ln
43-
command: ln -s /vagrant /var/www/vagrant creates=/var/www/vagrant
48+
- name: ln vagrant
49+
file: src=/vagrant dest=/var/www/vagrant state=link
4450

4551
- name: sites-available
4652
template: src=etc-apache2-sites-available-vagrant.conf.j2 dest=/etc/apache2/sites-available/vagrant.conf
4753
notify:
4854
- restart apache2
55+
when: ansible_os_family == 'Debian'
4956

5057
- name: disable site
5158
command: a2dissite 000-default.conf removes=/etc/apache2/sites-enabled/000-default.conf
5259
notify:
5360
- restart apache2
61+
when: ansible_os_family == 'Debian'
5462

5563
- name: enable site
5664
command: a2ensite vagrant.conf creates=/etc/apache2/sites-enabled/vagrant.conf
5765
notify:
5866
- restart apache2
67+
when: ansible_os_family == 'Debian'
68+
69+
- name: conf.d
70+
template: src=etc-httpd-conf.d-vagrant.conf.j2 dest=/etc/httpd/conf.d/vagrant.conf
71+
notify:
72+
- restart apache2
73+
when: ansible_os_family == 'RedHat'
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
<Directory /var/www/vagrant>
2+
Options FollowSymLinks
3+
AllowOverride All
4+
</Directory>
5+
16
<VirtualHost *:80>
2-
ServerName vagrant.dev
3-
DocumentRoot /var/www/vagrant
4-
<Directory /var/www/vagrant>
5-
Options FollowSymLinks
6-
AllowOverride All
7-
Order allow,deny
8-
allow from all
9-
</Directory>
7+
ServerName localhost
8+
ServerAdmin webmaster@localhost
9+
DocumentRoot /var/www/vagrant
10+
ErrorLog ${APACHE_LOG_DIR}/error.log
11+
CustomLog ${APACHE_LOG_DIR}/access.log combined
1012
</VirtualHost>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Directory /var/www/vagrant>
2+
Options FollowSymLinks
3+
AllowOverride All
4+
</Directory>
5+
6+
<VirtualHost *:80>
7+
ServerName localhost
8+
ServerAdmin webmaster@localhost
9+
DocumentRoot /var/www/vagrant
10+
ErrorLog ${APACHE_LOG_DIR}/error.log
11+
CustomLog ${APACHE_LOG_DIR}/access.log combined
12+
</VirtualHost>

provisioning/ansible/roles/mysql/vars/main.yml renamed to provisioning/ansible/roles/apache2/vars/debian.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
#=============================================================================
1919

2020
---
21+
apache2_service: apache2

provisioning/ansible/roles/postgresql/vars/main.yml renamed to provisioning/ansible/roles/apache2/vars/redhat.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
#=============================================================================
1919

2020
---
21+
apache2_service: httpd

provisioning/ansible/roles/common/tasks/main.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,48 @@
2020
---
2121
- name: apt update
2222
apt: cache_valid_time=3600 update_cache=yes
23+
when: ansible_pkg_mgr == 'apt'
2324

2425
- name: apt install
2526
apt: name={{ item }} state=present
2627
with_items:
28+
- bzip2
2729
- cmake
30+
- curl
2831
- git
32+
- gzip
33+
- nano
34+
- subversion
35+
- tar
2936
- unzip
37+
when: ansible_pkg_mgr == 'apt'
38+
39+
- name: yum update
40+
yum: update_cache=yes
41+
when: ansible_pkg_mgr == 'yum'
42+
43+
- name: yum install epel-release
44+
yum: name=epel-release state=present
45+
when: ansible_distribution in ['CentOS', 'RedHat']
46+
47+
- name: yum install
48+
yum: name={{ item }} state=present
49+
with_items:
50+
- bzip2
51+
- cmake
52+
- curl
53+
- git
54+
- gzip
55+
- nano
56+
- subversion
57+
- tar
58+
- unzip
59+
when: ansible_pkg_mgr == 'yum'
3060

3161
- name: chmod 0777
32-
file: path=core/configs mode=0777 recurse=yes state=directory
62+
file: path={{ item }} mode=0777 state=directory
63+
with_items:
64+
- /vagrant/core/configs
65+
- /vagrant/data
66+
- /vagrant/log
67+
- /vagrant/tmp

provisioning/ansible/roles/memcached/meta/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919

2020
---
2121
dependencies:
22-
- { role: common }
23-
- { role: apache2 }
22+
- { role: php }

provisioning/ansible/roles/memcached/tasks/main.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@
2525
- php5-memcached
2626
notify:
2727
- restart apache2
28+
when: ansible_pkg_mgr == 'apt'
2829

29-
- name: memcached.conf
30-
template: src=etc-memcached.conf.j2 dest=/etc/memcached.conf
30+
- name: yum install
31+
yum: name={{ item }} state=present
32+
with_items:
33+
- memcached
34+
- php-pecl-memcached
3135
notify:
32-
- restart memcached
36+
- restart apache2
37+
when: ansible_pkg_mgr == 'yum'

0 commit comments

Comments
 (0)