-
Notifications
You must be signed in to change notification settings - Fork 0
/
add-site.yml
56 lines (44 loc) · 1.06 KB
/
add-site.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
- hosts: web
tasks:
- name: create project folder
file: >
path=/var/www/{{ domain }}/public_html
state=directory
mode=0755
owner=www-data
group=www-data
sudo: yes
- name: create holding page
template: >
src=./templates/holding-page.html
dest=/var/www/{{ domain }}/public_html/index.html
owner=www-data
group=www-data
mode=644
sudo: yes
- name: add new virtualhost
template: >
src=./templates/vhost.conf
dest=/etc/apache2/sites-available/{{ domain }}.conf
sudo: yes
- name: enable site
shell: a2ensite {{ domain }}.conf
sudo: yes
notify:
- restart apache
handlers:
- name: restart apache
service: name=apache2 state=restarted
sudo: yes
- hosts: dns
tasks:
- name: add file to hosts
shell: printf '{{ web_ip }} {{ domain }}\n{{ web_ip}} www.{{ domain }}\r\r' >> /etc/hosts
sudo: yes
notify:
- restart dnsmasq
handlers:
- name: restart dnsmasq
service: name=dnsmasq state=restarted
sudo: yes