mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	awstats
This commit is contained in:
		
							parent
							
								
									7282498ccc
								
							
						
					
					
						commit
						90ae299665
					
				
					 4 changed files with 58 additions and 32 deletions
				
			
		| 
						 | 
				
			
			@ -1,44 +1,45 @@
 | 
			
		|||
- name: Create symlink awstats.conf from sites-enabled to sites-available (debuntu)
 | 
			
		||||
- name: Create symlink awstats.conf from sites-enabled to sites-available (Apache)
 | 
			
		||||
  file:
 | 
			
		||||
    src: /etc/apache2/sites-available/awstats.conf
 | 
			
		||||
    path: /etc/apache2/sites-enabled/awstats.conf
 | 
			
		||||
    state: link
 | 
			
		||||
  when: awstats_enabled and is_debuntu
 | 
			
		||||
  when: awstats_enabled and not nginx_enabled
 | 
			
		||||
 | 
			
		||||
- name: Remove symlink from sites-enabled, to disable AWStats (debuntu)
 | 
			
		||||
- name: Remove symlink from sites-enabled, to disable AWStats (Apache)
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/apache2/sites-enabled/awstats.conf
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: not awstats_enabled and is_debuntu
 | 
			
		||||
  when: not awstats_enabled or nginx_enabled
 | 
			
		||||
 | 
			
		||||
- name: Install nginx's files from template
 | 
			
		||||
  template:
 | 
			
		||||
    src: "{{ item.src }}"
 | 
			
		||||
    dest: "{{ item.dest }}"
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0644
 | 
			
		||||
  with_items:
 | 
			
		||||
     - { src: "awstats-nginx.conf", dest: "/etc/nginx/conf.d/" }
 | 
			
		||||
     - { src: "cgi-bin.php", dest: "/etc/nginx/" }
 | 
			
		||||
  when: awstats_enabled and nginx_enabled
 | 
			
		||||
 | 
			
		||||
- name: Remove /etc/nginx/conf.d/awstats-nginx.conf
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/nginx/conf.d/awstats-nginx.conf
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: not awstats_enabled
 | 
			
		||||
 | 
			
		||||
- name: Restart Apache service ({{ apache_service }})
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: "{{ apache_service }}"
 | 
			
		||||
    state: restarted
 | 
			
		||||
  when: awstats_enabled and not nginx_enabled
 | 
			
		||||
 | 
			
		||||
- name: Install /etc/awstats/awstats.schoolserver.conf
 | 
			
		||||
  template:
 | 
			
		||||
    src: awstats.schoolserver.conf.j2
 | 
			
		||||
    dest: /etc/awstats/awstats.schoolserver.conf
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0644
 | 
			
		||||
  when: awstats_enabled | bool
 | 
			
		||||
 | 
			
		||||
- name: Create a symlink /etc/awstats/awstats.conf for access by IP address
 | 
			
		||||
  file:
 | 
			
		||||
    src: /etc/awstats/awstats.schoolserver.conf
 | 
			
		||||
    path: /etc/awstats/awstats.conf
 | 
			
		||||
    state: link
 | 
			
		||||
  when: awstats_enabled | bool
 | 
			
		||||
 | 
			
		||||
- name: On first enabling of AWStats, summarize httpd logs up to now (OS's other than debuntu)
 | 
			
		||||
  shell: /bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=schoolserver -update
 | 
			
		||||
  when: awstats_enabled and not is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: On first enabling of AWStats, summarize httpd logs up to now (debuntu)
 | 
			
		||||
  shell: /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=schoolserver -update
 | 
			
		||||
  when: awstats_enabled and is_debuntu
 | 
			
		||||
- name: Restart nginx service
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: nginx
 | 
			
		||||
    state: restarted
 | 
			
		||||
  when: awstats_enabled and nginx_enabled
 | 
			
		||||
 | 
			
		||||
- name: Add 'awstats' variable values to {{ iiab_ini_file }}
 | 
			
		||||
  ini_file:
 | 
			
		||||
| 
						 | 
				
			
			@ -55,4 +56,3 @@
 | 
			
		|||
      value: "{{ awstats_install }}"
 | 
			
		||||
    - option: enabled
 | 
			
		||||
      value: "{{ awstats_enabled }}"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,7 +36,7 @@
 | 
			
		|||
    - "{{ apache_log_dir }}"
 | 
			
		||||
    - /usr/lib/cgi-bin/awstats   # create backward compatible path for awstats
 | 
			
		||||
 | 
			
		||||
- name: Install nginx's awstats.conf from template (debuntu)
 | 
			
		||||
- name: Install Apache's awstats.conf from template (debuntu)
 | 
			
		||||
  template:
 | 
			
		||||
    src: "{{ item.src }}"
 | 
			
		||||
    dest: "{{ item.dest }}"
 | 
			
		||||
| 
						 | 
				
			
			@ -44,9 +44,9 @@
 | 
			
		|||
    group: root
 | 
			
		||||
    mode: 0644
 | 
			
		||||
  with_items:
 | 
			
		||||
     - { src: "awstats-nginx.conf", dest: "/etc/nginx/conf.d/" }
 | 
			
		||||
     - { src: "cgi-bin.php", dest: "/etc/nginx/" }
 | 
			
		||||
#     - { src: "apache-awstats.conf", dest: "/etc/{{ apache_config_dir }}/awstats.conf" }
 | 
			
		||||
#     - { src: "awstats-nginx.conf", dest: "/etc/nginx/conf.d/" }
 | 
			
		||||
#     - { src: "cgi-bin.php", dest: "/etc/nginx/" }
 | 
			
		||||
     - { src: "apache-awstats.conf", dest: "/etc/{{ apache_config_dir }}/awstats.conf" }
 | 
			
		||||
  when: awstats_enabled and is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Ensure logrotate doesn't make logs unreadable (debuntu)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,3 +22,6 @@
 | 
			
		|||
- name: Enable Sugarizer for Apache
 | 
			
		||||
  command: a2ensite sugarizer.conf
 | 
			
		||||
 | 
			
		||||
- name: Enable AWStats for Apache
 | 
			
		||||
  command: a2ensite awstats.conf
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,26 @@
 | 
			
		|||
- name: Remove symlink /etc/apache2/sites-enabled/awstats.conf
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/apache2/sites-enabled/awstats.conf
 | 
			
		||||
    state: absent
 | 
			
		||||
 | 
			
		||||
- name: Install nginx support for awstats if awstats_enabled
 | 
			
		||||
  copy:
 | 
			
		||||
    backup: no
 | 
			
		||||
    src: "{{ item.src }}"
 | 
			
		||||
    dest: "{{ item.dest }}"
 | 
			
		||||
    mode: "{{ item.mode }}"
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
  with_items:
 | 
			
		||||
    - { src: 'roles/awstats/templates/awstats-nginx.conf', dest: '/etc/nginx/conf.d/kiwix-nginx.conf' , mode: '0644' }
 | 
			
		||||
  when: awstats_enabled
 | 
			
		||||
 | 
			
		||||
- name: Remove nginx support for kiwix
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/nginx/conf.d/awstats-nginx.conf
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: not awstats_enabled
 | 
			
		||||
 | 
			
		||||
- name: Remove symlink /etc/apache2/sites-enabled/kiwix.conf
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/apache2/sites-enabled/kiwix.conf
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue