From 8d7be2a4659f20af0386048b2444f6d0adc59c41 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 24 Apr 2017 12:57:57 +0300 Subject: Rename roles to be more specific Suggested by Ivan Dolgov. --- roles/apache_server/tasks/main.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 roles/apache_server/tasks/main.yml (limited to 'roles/apache_server/tasks') diff --git a/roles/apache_server/tasks/main.yml b/roles/apache_server/tasks/main.yml new file mode 100644 index 0000000..8a14b35 --- /dev/null +++ b/roles/apache_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 -- cgit v1.2.1