2019-11-19 17:25:51 +00:00
- name : Create symlink awstats.conf from sites-enabled to sites-available (Apache)
2019-09-05 10:30:20 +00:00
file :
src : /etc/apache2/sites-available/awstats.conf
path : /etc/apache2/sites-enabled/awstats.conf
state : link
2019-11-19 17:25:51 +00:00
when : awstats_enabled and not nginx_enabled
2019-09-05 10:30:20 +00:00
2019-11-19 17:25:51 +00:00
- name : Remove symlink from sites-enabled, to disable AWStats (Apache)
2019-09-05 10:30:20 +00:00
file :
path : /etc/apache2/sites-enabled/awstats.conf
state : absent
2019-11-19 17:25:51 +00:00
when : not awstats_enabled or nginx_enabled
2019-09-09 17:14:13 +00:00
2019-11-19 17:25:51 +00:00
- name : Install nginx's files 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 }}"
2019-09-05 10:30:20 +00:00
owner : root
group : root
mode : 0644
2019-11-19 17:25:51 +00:00
with_items :
- { src : "awstats-nginx.conf" , dest : "/etc/nginx/conf.d/" }
- { src : "cgi-bin.php" , dest : "/etc/nginx/" }
when : awstats_enabled and nginx_enabled
2019-09-05 10:30:20 +00:00
2019-11-19 17:25:51 +00:00
- name : Remove /etc/nginx/conf.d/awstats-nginx.conf
2019-09-05 10:30:20 +00:00
file :
2019-11-19 17:25:51 +00:00
path : /etc/nginx/conf.d/awstats-nginx.conf
state : absent
when : not awstats_enabled
2019-09-05 10:30:20 +00:00
2019-11-19 17:25:51 +00:00
- name : Restart Apache service ({{ apache_service }})
systemd :
name : "{{ apache_service }}"
state : restarted
when : awstats_enabled and not nginx_enabled
2019-09-05 10:30:20 +00:00
2019-11-19 17:25:51 +00:00
- name : Restart nginx service
systemd :
name : nginx
state : restarted
when : awstats_enabled and nginx_enabled
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 }}"
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 }}"