- 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 not nginx_enabled - name: Remove symlink from sites-enabled, to disable AWStats (Apache) file: path: /etc/apache2/sites-enabled/awstats.conf state: absent 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: 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: 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 }}"