Skip to content

Commit 0d22ebe

Browse files
committed
Improved variable handling, Added customizable domain
Fixes #33
1 parent d958885 commit 0d22ebe

File tree

11 files changed

+152
-37
lines changed

11 files changed

+152
-37
lines changed

provision/ansible/default.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
3+
developmentDomain: 'vm'

provision/ansible/playbook.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
remote_user: vagrant
33
sudo_user: root
44
sudo: yes
5+
vars_files:
6+
- /vagrant/provision/ansible/default.yml
7+
- /vagrant/vm.yml
58
roles:
69
- common
710
- disk
Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
- include_vars: /vagrant/vm.yml
2-
31
- name: Setup automatic startup maintenance (clitools)
42
lineinfile:
53
destfile: /etc/rc.local
64
insertbefore: '^exit 0'
75
line: '/usr/local/bin/ct system:startup > /dev/null'
86
state: present
97

10-
- name: Copy local configuration
11-
copy:
12-
src: roles/clitools/files/clitools.ini
8+
- name: Deploy local configuration
9+
template:
10+
src: roles/clitools/templates/clitools.ini.j2
1311
dest: /etc/clitools.ini
1412
owner: vagrant
15-
group: vagrant
13+
group: root
1614
mode: 0644
1715

1816
- name: Copy cron configuration
@@ -23,26 +21,5 @@
2321
group: root
2422
mode: 0644
2523

26-
- name: Setup growl password
27-
lineinfile:
28-
dest: /etc/clitools.ini
29-
regexp: '; password = growlpassword'
30-
line: 'password = "{{ growlPassword }}"'
31-
when: growlPassword is defined
32-
33-
# Not working correclty because of issue:
34-
# https://github.com/ansible/ansible-modules-core/issues/1500
35-
#
36-
#- name: Setup growl support
37-
# ini_file:
38-
# dest: '/etc/clitools.ini'
39-
# section: '{{ item.section }}'
40-
# option: '{{ item.option }}'
41-
# value: '{{ item.value }}'
42-
# with_items:
43-
# - { section: 'growl', option: 'password', value: '{{ growlPassword }}' }
44-
# - { section: 'syscheck', option: 'wall', value: '0' }
45-
# when: growlPassword is defined
46-
4724
- name: Run clitools system startup
4825
raw: '/usr/local/bin/ct system:startup > /dev/null'
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[config]
2+
ssh_conf_path = "/vagrant/provision/sshconfig/"
3+
domain_dev = "{{ developmentDomain }}"
4+
5+
[db]
6+
dsn = "mysql:host=127.0.0.1;port=13306"
7+
username = "root"
8+
password = "dev"
9+
debug_log_dir = "/tmp/debug/"
10+
11+
[syscheck]
12+
enabled = 1
13+
{% if growlPassword is defined %}
14+
wall = 0
15+
growl = 1
16+
{% else %}
17+
wall = 1
18+
growl = 0
19+
{% endif %}
20+
diskusage = 90
21+
22+
[growl]
23+
server = 192.168.56.1
24+
password = "{{ growlPassword }}"
25+
26+
[docker]
27+
container = main
28+
interface = docker0
29+
30+
climethod = docker-exec
31+
; climethod = dockercompose-run
32+
33+
[commands]
34+
; not used commands here
35+
ignore[] = "CliTools\Console\Command\Log\ApacheCommand"
36+
ignore[] = "CliTools\Console\Command\Log\PhpCommand"
37+
ignore[] = "CliTools\Console\Command\Log\DebugCommand"
38+
ignore[] = "CliTools\Console\Command\Apache\RestartCommand"
39+
ignore[] = "CliTools\Console\Command\Mysql\RestartCommand"
40+
ignore[] = "CliTools\Console\Command\Php\RestartCommand"
41+
ignore[] = "CliTools\Console\Command\Samba\RestartCommand"
42+
ignore[] = "CliTools\Console\Command\System\UpdateCommand"
43+
ignore[] = "CliTools\Console\Command\System\RebootCommand"
44+
ignore[] = "CliTools\Console\Command\Vagrant\*Command"
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
address=/vm.dev/{{ ansible_eth1.ipv4.address }}
2-
address=/vm/{{ ansible_eth1.ipv4.address }}
1+
address=/{{ developmentDomain }}/{{ ansible_eth1.ipv4.address }}

provision/ansible/roles/docker-proxy/tasks/configuration.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,13 @@
55
dest: /etc/apache2/
66
delete: no
77

8+
- name: Deploy apache configuration (template)
9+
template:
10+
src: roles/docker-proxy/templates/20-macro-docker-proxy.conf
11+
dest: /etc/apache2/conf-vm/20-macro-docker-proxy.conf
12+
owner: vagrant
13+
group: root
14+
mode: 0644
15+
816
- name: Reload apache2
917
command: service apache2 restart
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#############################
2+
# DockerProxy
3+
#############################
4+
<Macro DockerProxy $project $port>
5+
<VirtualHost *:80>
6+
ServerName $project.{{ developmentDomain }}
7+
ServerAlias *.$project.{{ developmentDomain }}
8+
9+
Use ProxyPass / http://127.0.0.1:$port/
10+
</VirtualHost>
11+
</Macro>
12+
13+
<Macro DockerProxySSL $project $port>
14+
<VirtualHost *:443>
15+
ServerName $project.{{ developmentDomain }}
16+
ServerAlias *.$project.{{ developmentDomain }}
17+
18+
Use ProxyPassSSL / https://127.0.0.1:$port/
19+
Use SSL
20+
</VirtualHost>
21+
</Macro>
22+
23+
24+
#############################
25+
# DockerProxyFallback
26+
#############################
27+
28+
<Macro DockerProxyFallback $port>
29+
<VirtualHost *:80>
30+
ServerName docker-fallback.{{ developmentDomain }}
31+
ServerAlias *.{{ developmentDomain }}
32+
33+
Use ProxyPass / http://127.0.0.1:$port/
34+
</VirtualHost>
35+
</Macro>
36+
37+
<Macro DockerProxyFallbackSSL $port>
38+
<VirtualHost *:443>
39+
ServerName docker-fallback.{{ developmentDomain }}
40+
ServerAlias *.{{ developmentDomain }}
41+
42+
Use ProxyPassSSL / https://127.0.0.1:$port/
43+
Use SSL
44+
</VirtualHost>
45+
</Macro>
46+
47+
#############################
48+
# DockerProxyVagrantShare
49+
#############################
50+
51+
<Macro DockerProxyVagrantShare $port>
52+
<VirtualHost *:80>
53+
ServerName docker-fallback.{{ developmentDomain }}
54+
ServerAlias *.vagrantshare.com
55+
56+
Use ProxyPass / http://127.0.0.1:$port/
57+
58+
#RewriteEngine On
59+
#RewriteCond %{HTTP_HOST}/%{REQUEST_URI} ^(.*)\.[^\.]+\.vagrantshare\.com/(.*)$
60+
#RewriteRule (.*) http://%1.vm:$port/%2 [P,L]
61+
</VirtualHost>
62+
</Macro>
63+
64+
<Macro DockerProxyVagrantShareSSL $port>
65+
<VirtualHost *:443>
66+
ServerName vagrantshare.{{ developmentDomain }}
67+
ServerAlias *.vagrantshare.com
68+
69+
Use ProxyPassSSL / https://127.0.0.1:$port/
70+
Use SSL
71+
72+
#RewriteEngine On
73+
#RewriteCond %{HTTP_HOST}/%{REQUEST_URI} ^(.*)\.[^\.]+\.vagrantshare\.com/(.*)$
74+
#RewriteRule (.*) https://%1.vm:$port/%2 [P,L]
75+
</VirtualHost>
76+
</Macro>
77+
78+
79+
#############################
80+
# DockerProxySolr
81+
#############################
82+
<Macro DockerProxySolr $project $port>
83+
<VirtualHost *:80>
84+
ServerName $project.{{ developmentDomain }}
85+
86+
Use ProxyPass /solr/ http://127.0.0.1:$port/solr/
87+
Redirect / /solr/
88+
</VirtualHost>
89+
</Macro>

provision/ansible/roles/docker/tasks/configuration.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
- include_vars: /vagrant/vm.yml
2-
31
- name: Configure docker
42
lineinfile:
53
dest: '/etc/default/docker'

provision/ansible/roles/user/tasks/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
- include_vars: /vagrant/vm.yml
2-
31
- name: Setup ssh key (from github, authorized keys)
42
include: github-ssh-key.yml
53
when: githubUser is defined

provision/ansible/roles/user/tasks/shell.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
- include_vars: /vagrant/vm.yml
2-
31
- name: Setup ssh key (from github)
42
include: github-ssh-key.yml
53
when: githubUser is defined

0 commit comments

Comments
 (0)