diff options
-rw-r--r-- | playbooks/osci.theopensourceway.org.yml | 7 | ||||
-rw-r--r-- | roles/awstats/meta/main.yml | 3 | ||||
-rw-r--r-- | roles/awstats/tasks/main.yml | 18 | ||||
-rw-r--r-- | roles/awstats/templates/awstats.conf | 7 | ||||
-rw-r--r-- | roles/awstats/templates/logs.conf | 2 | ||||
-rw-r--r-- | roles/awstats_vhost/meta/main.yml | 8 | ||||
-rw-r--r-- | roles/awstats_vhost/tasks/main.yml | 18 | ||||
-rw-r--r-- | roles/awstats_vhost/templates/awstats.conf | 17 |
8 files changed, 80 insertions, 0 deletions
diff --git a/playbooks/osci.theopensourceway.org.yml b/playbooks/osci.theopensourceway.org.yml index a4eb71b..f87f77b 100644 --- a/playbooks/osci.theopensourceway.org.yml +++ b/playbooks/osci.theopensourceway.org.yml @@ -27,6 +27,13 @@ - role: old_wiki old_wiki_dir: /var/www/old_server/wiki/ website_domain: www.theopensourceway.org + + - role: awstats + vhosts: + - www.theopensourceway.org + - role: awstats_vhost + website_domain: stats.theopensourceway.org + - deploy_website # - role: mailman_lists diff --git a/roles/awstats/meta/main.yml b/roles/awstats/meta/main.yml new file mode 100644 index 0000000..791037b --- /dev/null +++ b/roles/awstats/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: +- { role: httpd } diff --git a/roles/awstats/tasks/main.yml b/roles/awstats/tasks/main.yml new file mode 100644 index 0000000..3c08700 --- /dev/null +++ b/roles/awstats/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- name: Install package + package: + name: + - awstats + state: present + +- template: + src: awstats.conf + dest: "/etc/awstats/awstats.{{ item }}.conf" + with_items: "{{ vhosts }}" + +- template: + src: logs.conf + dest: "/etc/httpd/conf.d/{{ item }}.conf.d/logs.conf" + with_items: "{{ vhosts }}" + notify: verify config and restart httpd + diff --git a/roles/awstats/templates/awstats.conf b/roles/awstats/templates/awstats.conf new file mode 100644 index 0000000..13a4d96 --- /dev/null +++ b/roles/awstats/templates/awstats.conf @@ -0,0 +1,7 @@ +LogFile="/var/log/httpd/{{ item }}_ssl_access.fixed.log" +LogType=W +LogFormat="%time1 %host %other %other %methodurl %bytesd" +SiteDomain={{ item }} +DNSLookup=1 +DynamicDNSLookup=1 +BuildReportFormat=xhtml diff --git a/roles/awstats/templates/logs.conf b/roles/awstats/templates/logs.conf new file mode 100644 index 0000000..e8a1965 --- /dev/null +++ b/roles/awstats/templates/logs.conf @@ -0,0 +1,2 @@ +CustomLog logs/{{ item }}_ssl_access.fixed.log combined + diff --git a/roles/awstats_vhost/meta/main.yml b/roles/awstats_vhost/meta/main.yml new file mode 100644 index 0000000..19433aa --- /dev/null +++ b/roles/awstats_vhost/meta/main.yml @@ -0,0 +1,8 @@ +--- +dependencies: +- role: httpd + documentroot: /usr/share/awstats/wwwroot/ + redirects: + - src: '^/$' + target: '/cgi-bin/awstats.pl' + match: True diff --git a/roles/awstats_vhost/tasks/main.yml b/roles/awstats_vhost/tasks/main.yml new file mode 100644 index 0000000..90d0691 --- /dev/null +++ b/roles/awstats_vhost/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- name: Deploy custom config for awstats + template: + dest: "/etc/httpd/conf.d/{{ _website_domain }}.conf.d/awstats.conf" + src: awstats.conf + notify: verify config and restart httpd + +- package: + name: python-passlib + state: present + +- htpasswd: + path: /etc/httpd/htpasswd + name: "guest" + password: "{{ awstats_guest_password }}" + owner: root + group: apache + mode: 0640 diff --git a/roles/awstats_vhost/templates/awstats.conf b/roles/awstats_vhost/templates/awstats.conf new file mode 100644 index 0000000..b7c013f --- /dev/null +++ b/roles/awstats_vhost/templates/awstats.conf @@ -0,0 +1,17 @@ +ScriptAlias /cgi-bin/ "/usr/share/awstats/wwwroot/cgi-bin/" + +SetEnv AWSTATS_CONFIG www.theopensourceway.org +<Directory "/usr/share/awstats/wwwroot/cgi-bin"> + Options +ExecCGI + AddHandler cgi-script .pl + AllowOverride None + Require all granted +</Directory> + +<Location / > + AuthType Basic + AuthName "Authentication Required" + AuthUserFile "/etc/httpd/htpasswd" + require valid-user +</Location> + |