summaryrefslogtreecommitdiff
path: root/roles/web_server/tasks/main.yml
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-04-21 16:34:57 +0300
committerLars Wirzenius <liw@liw.fi>2017-04-21 16:34:57 +0300
commitbc0d7897d1f4a88d5d60b9460a3fd52a3fc196bc (patch)
tree1c7c784c3dfe9277f06a43342dd117cfd204859a /roles/web_server/tasks/main.yml
parent62f6d8f4af75970358c661528310d397d57ec8ee (diff)
downloaddebian-ansible-bc0d7897d1f4a88d5d60b9460a3fd52a3fc196bc.tar.gz
Add web_server and git_server roles
Need git_server for the new QvarnLabs git server, and the git server relies on the web server for cgit.
Diffstat (limited to 'roles/web_server/tasks/main.yml')
-rw-r--r--roles/web_server/tasks/main.yml38
1 files changed, 38 insertions, 0 deletions
diff --git a/roles/web_server/tasks/main.yml b/roles/web_server/tasks/main.yml
new file mode 100644
index 0000000..8a14b35
--- /dev/null
+++ b/roles/web_server/tasks/main.yml
@@ -0,0 +1,38 @@
+- name: install rsync (so one can publish files via server)
+ apt: name=rsync
+
+- name: install apache2
+ apt: name=apache2
+
+- name: create dirs for static site contents
+ file:
+ state: directory
+ path: "/srv/http/{{ item.domain }}"
+ owner: "{{ item.owner }}"
+ group: "{{ item.owner }}"
+ mode: 0755
+ with_items: "{{ static_sites }}"
+
+- name: create log dirs for websites
+ file:
+ state: directory
+ path: "/var/log/apache2/{{ item.domain }}"
+ owner: www-data
+ group: www-data
+ mode: 0755
+ with_items: "{{ static_sites }}"
+
+- name: configure apache to serve static sites
+ template:
+ src: virtualhost.conf.tmpl
+ dest: "/etc/apache2/sites-available/{{ item.domain }}.conf"
+ owner: root
+ group: root
+ mode: 0644
+ with_items: "{{ static_sites }}"
+
+- name: enable apache sites
+ shell: a2ensite "{{ item.domain }}"
+ with_items: "{{ static_sites }}"
+ notify:
+ - restart apache