1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/awstats/tasks/enable.yml

56 lines
1.8 KiB
YAML
Raw Normal View History

2020-01-10 23:18:12 +00:00
# Apache
2020-01-11 23:26:00 +00:00
- name: Enable http://box/awstats and/or http://box/awstats/awstats.pl via Apache
command: a2ensite awstats.conf
when: apache_install and awstats_enabled
2020-01-10 23:18:12 +00:00
2020-01-11 23:26:00 +00:00
- name: Disable http://box/awstats and/or http://box/awstats/awstats.pl via Apache
command: a2dissite awstats.conf
when: apache_install and not awstats_enabled
2019-09-05 10:30:20 +00:00
2020-01-10 23:18:12 +00:00
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
2020-01-11 23:26:00 +00:00
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
2020-01-10 23:18:12 +00:00
state: restarted
2020-01-11 23:26:00 +00:00
when: apache_enabled | bool
2020-01-10 23:18:12 +00:00
# NGINX
2020-01-11 23:26:00 +00:00
- name: Enable http://box/awstats via NGINX, by installing /etc/nginx/cgi-bin.php & {{ nginx_config_dir }}/awstats-nginx.conf from template
2019-09-05 10:30:20 +00:00
template:
2019-11-19 17:25:51 +00:00
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
2020-01-11 23:26:00 +00:00
- { src: "awstats-nginx.conf", dest: "{{ nginx_config_dir }}/" }
- { src: "cgi-bin.php", dest: "/etc/nginx/" }
when: nginx_install and awstats_enabled
- name: Disable http://box/awstats_url via NGINX, by removing {{ nginx_config_dir }}/awstats-nginx.conf
file:
path: "{{ nginx_config_dir }}/awstats-nginx.conf"
state: absent
when: nginx_install and not awstats_enabled
2019-09-05 10:30:20 +00:00
2020-01-11 23:26:00 +00:00
- name: Restart 'nginx' systemd service
2019-11-19 17:25:51 +00:00
systemd:
name: nginx
state: restarted
2020-01-10 23:18:12 +00:00
when: nginx_enabled | bool
2019-09-05 10:30:20 +00:00
2020-01-11 23:26:00 +00:00
2019-09-05 10:30:20 +00:00
- name: Add 'awstats' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
section: awstats
option: "{{ item.option }}"
value: "{{ item.value | string }}"
2019-09-05 10:30:20 +00:00
with_items:
- option: name
value: AWStats
- option: description
value: '"AWStats (originally known as Advanced Web Statistics) is a package written in Perl which generates static or dynamic html summaries based upon web server logs."'
- option: installed
value: "{{ awstats_install }}"
- option: enabled
value: "{{ awstats_enabled }}"