1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00
iiab/roles/awstats/tasks/enable.yml

73 lines
2.3 KiB
YAML
Raw Normal View History

2020-01-10 23:18:12 +00:00
# Apache
- name: Remove symlink /etc/apache2/sites-enabled/awstats.conf
file:
path: /etc/apache2/sites-enabled/awstats.conf
state: absent
when: not awstats_enabled or nginx_enabled
#- name: 'Install from template: /etc/{{ apache_config_dir }}/awstats.conf'
# template:
# src: apache-awstats.conf
# dest: "/etc/{{ apache_config_dir }}/awstats.conf"
# owner: root # Not nec? Remove?
# group: root # Not nec? Remove?
# mode: 0644 # Not nec? Remove?
# when: not nginx_enabled
- name: Symlink /etc/apache2/sites-enabled/awstats.conf -> /etc/{{ apache_config_dir }}/awstats.conf
2019-09-05 10:30:20 +00:00
file:
2020-01-10 23:18:12 +00:00
src: "/etc/{{ apache_config_dir }}/awstats.conf"
2019-09-05 10:30:20 +00:00
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
2020-01-10 23:18:12 +00:00
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}"
state: restarted
when: awstats_enabled and not nginx_enabled
# NGINX
- name: Remove {{ nginx_config_dir }}/awstats-nginx.conf
2019-09-05 10:30:20 +00:00
file:
2020-01-10 23:18:12 +00:00
path: "{{ nginx_config_dir }}/awstats-nginx.conf"
2019-09-05 10:30:20 +00:00
state: absent
2020-01-10 23:18:12 +00:00
when: not awstats_enabled or not nginx_enabled
2019-09-09 17:14:13 +00:00
2020-01-10 23:18:12 +00:00
- name: 'Install from template: /etc/nginx/cgi-bin.php, {{ nginx_config_dir }}/awstats-nginx.conf'
2019-09-05 10:30:20 +00:00
template:
2019-11-19 17:25:51 +00:00
src: "{{ item.src }}"
dest: "{{ item.dest }}"
2020-01-10 23:18:12 +00:00
owner: root # Not nec? Remove?
group: root # Not nec? Remove?
mode: 0644 # Not nec? Remove?
2019-11-19 17:25:51 +00:00
with_items:
2020-01-04 06:36:28 +00:00
- { src: "awstats-nginx.conf", dest: "{{ nginx_config_dir }}/" }
2019-11-19 17:25:51 +00:00
- { src: "cgi-bin.php", dest: "/etc/nginx/" }
when: awstats_enabled and nginx_enabled
2019-09-05 10:30:20 +00:00
2020-01-10 23:18:12 +00:00
- name: Restart nginx systemd service
2019-11-19 17:25:51 +00:00
systemd:
name: nginx
2020-01-10 23:18:12 +00:00
daemon_reload: yes
2019-11-19 17:25:51 +00:00
state: restarted
2020-01-10 23:18:12 +00:00
when: nginx_enabled | bool
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 }}"