--- - name: Install python3-pandas package ansible.builtin.package: state=present name=python3-pandas tags: - packages - web-data when: ansible_distribution_major_version|int < 9 - name: Make sure the /usr/local/share/web-data-analysis directory exists ansible.builtin.file: path=/usr/local/share/web-data-analysis state=directory tags: - web-data - name: Make the data directory ansible.builtin.file: path=/mnt/fedora_stats/data state=directory mode=0755 tags: - web-data - name: Make the data subdirs ansible.builtin.file: path=/mnt/fedora_stats/data/{{item}} state=directory mode=0755 with_items: [mirrors] tags: - web-data - name: Copy over website index. ansible.builtin.copy: src=html/main-index.html dest=/var/www/html/index.html mode=0644 tags: - web-data - name: Make a css tree ansible.builtin.file: path=/var/www/html/css/ state=directory mode=0755 tags: - web-data - name: Css files ansible.builtin.copy: src={{item}} dest=/var/www/html/css/ mode=0644 with_items: [html/css/data-reports.css, html/css/normalize.css] tags: - web-data - name: Make the web directory exists ansible.builtin.file: path=/var/www/html/csv-reports/ state=directory mode=0755 tags: - web-data - name: Make the web subdirs ansible.builtin.file: path=/var/www/html/csv-reports/{{item}} state=directory mode=0755 with_items: [images, mirrors] tags: - web-data - name: Make the web directory summary. ansible.builtin.copy: src=html/summary.html dest=/var/www/html/csv-reports/images/ mode=0644 tags: - web-data - name: Clean out non-useful images ansible.builtin.file: path="/var/www/html/csv-reports/images/{{item}}" state=absent with_items: [hotspot-all.png, fedora-rev-latest-stacked.png] - name: Scripts to condense data down for further processing ansible.builtin.copy: src={{item}} dest=/usr/local/bin/ mode=0755 with_items: [condense-mirrorlogs.sh] tags: - web-data - name: Python scripts to calculate various data ansible.builtin.copy: src={{item}} dest=/usr/local/bin/ mode=0755 with_items: [mirrorlist.py] tags: - web-data - name: Awk files for csv creation ansible.builtin.copy: src={{item}} dest=/usr/local/share/web-data-analysis mode=0644 with_items: [mirrors-data.awk] tags: - web-data - name: Gnuplot file for image creation ansible.builtin.copy: src={{item}} dest=/usr/local/share/web-data-analysis mode=0644 with_items: [mirrors-data.gp] tags: - web-data - name: Daily cron file to run the log files ansible.builtin.copy: src={{item}} dest=/etc/cron.d/ mode=0644 with_items: [condense-mirrorlogs.cron] tags: - web-data - cron - name: Install package deps for mirrors-countme ansible.builtin.package: # tqdm is optional but it gives nice progress meters for interactive use name: ['python3-pip', 'python3-setuptools', 'python3-tqdm'] state: present tags: - packages - web-data - name: Make countme group group: name: countme tags: - web-data - name: Make countme user user: name: countme group: countme shell: /sbin/nologin home: /srv/countme comment: "DNF countme counter" tags: - web-data - name: Install the python3.11-mirrors-countme RPM package ansible.builtin.package: name: python3.11-mirrors-countme state: present tags: - web-data - packages - name: Remove local mirrors-countme git repo, scripts and Python package # Using `shell` here because `file` doesn't know wild cards ansible.builtin.shell: >- shopt -s nullglob; rm -rfv \ /srv/countme/mirrors-countme \ /usr/local/bin/countme-csv2sqlite.sh \ /usr/local/bin/countme-sqlite2csv.sh \ /usr/local/bin/countme-totals.py \ /usr/local/bin/countme-update-rawdb.sh \ /usr/local/bin/countme-update-totals.sh \ /usr/local/bin/parse-access-log.py \ /usr/local/lib/python3.*/site-packages/countme \ /usr/local/lib/python3.*/site-packages/mirrors_countme-*-py3.*.egg* register: wda_rm_local_pypkg changed_when: wda_rm_local_pypkg.stdout != "" failed_when: wda_rm_local_pypkg.rc != 0 tags: - web-data - name: Make countme web subdir ansible.builtin.file: path=/var/www/html/csv-reports/countme state=directory mode=0775 owner=countme group=countme tags: - web-data - name: Make countme local data dir ansible.builtin.file: path=/var/lib/countme state=directory mode=0775 owner=countme group=countme tags: - web-data - name: Ensure messaging script is installed import_role: name=fedora-messaging-utils tags: - web-data - cron - name: Install countme script to parse new logs & update totals ansible.builtin.copy: src=countme-update.sh dest=/usr/local/bin/ mode=0755 tags: - web-data - name: Install CentOS countme script to parse new logs & update totals ansible.builtin.copy: src=countme-centos-update.sh dest=/usr/local/bin/ mode=0755 tags: - web-data - name: Install cron file to run countme-update.sh daily ansible.builtin.copy: src=countme-update.cron dest=/etc/cron.d/ mode=0644 tags: - web-data - cron - name: Remove old syncHttpLogs.sh cron script only on log01 ansible.builtin.file: path: /etc/cron.daily/syncHttpLogs.sh state: absent when: inventory_hostname.startswith('log01') tags: - web-data - cron - name: Write configuration file for script to sync httpd logs ansible.builtin.template: src: sync-http-logs.yaml.j2 dest: /etc/sync-http-logs.yaml when: inventory_hostname.startswith('log01') tags: - web-data - config - name: Install a script to sync httpd logs via cron only on log01 ansible.builtin.copy: src: sync-http-logs.py dest: /usr/local/bin/sync-http-logs.py mode: "0755" when: inventory_hostname.startswith('log01') tags: - web-data - cron - name: Remove sync-http-logs.py from cron.daily directory ansible.builtin.file: path: /etc/cron.daily/sync-http-logs.py state: absent when: inventory_hostname.startswith('log01') tags: - web-data - cron - name: Install awstats package ansible.builtin.package: state=present name=awstats tags: - packages - web-data - name: Make the awstats directory ansible.builtin.file: path=/var/www/html/awstats-reports state=directory tags: - web-data - name: Proxy log merge script (log01) ansible.builtin.copy: src=combineHttpLogs.sh dest=/usr/local/bin/ mode=0755 tags: - config - web-data - name: Remove separate daily cron job to merge old logs ansible.builtin.file: path: /etc/cron.d/combineHttp.cron state: absent tags: - web-data - cron - name: Install daily cron job to sync and merge log files ansible.builtin.copy: src: sync-http-logs-and-merge.sh dest: /etc/cron.daily mode: "0755" tags: - web-data - cron - name: Compress logs script (log01) ansible.builtin.copy: src=compress_logs.sh dest=/usr/local/bin/ mode=0755 tags: - config - web-data