system-config/playbooks/periodic/goaccess.yaml
Jeremy Stanley 330a5e02e6 Correct static known_hosts entry for goaccess jobs
When the static.opendev.org service was replaced up a new server, we
neglected to update its SSH known_hosts entry in *-goaccess-report
jobs, so they began failing. Get them back on track.

Change-Id: I7a4902d6edfbc0bbfedbc6dbf9ea7e93acd04386
2023-08-07 21:27:40 +00:00

80 lines
2.8 KiB
YAML

- hosts: localhost
tasks:
- name: Add static.opendev.org to inventory
add_host:
name: static.opendev.org
ansible_connection: ssh
ansible_host: static.opendev.org
ansible_port: 22
ansible_user: zuul
# Port 19885 is firewalled
zuul_console_disabled: true
- name: Add static.opendev.org host key
known_hosts:
name: static.opendev.org
key: static.opendev.org,104.130.253.131,2001:4800:7818:103:be76:4eff:fe01:f37d ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL8zOJsEv2BGGZK2Exm8UmPY/p23wkE7HFqxIH0V31jol+1I4dzAEYKxvycwnD4m4rQXwGoRIyIrUT8JT+qmP6s=
- hosts: static.opendev.org
tasks:
- name: Configure goaccess
copy:
dest: /home/zuul/goaccess.conf
owner: zuul
group: zuul
mode: '0444'
content: |
log-format COMBINED
ignore-panel VISITORS
ignore-panel REQUESTS
ignore-panel REQUESTS_STATIC
ignore-panel NOT_FOUND
ignore-panel HOSTS
ignore-panel OS
ignore-panel BROWSERS
ignore-panel VISIT_TIMES
ignore-panel VIRTUAL_HOSTS
ignore-panel REFERRERS
ignore-panel REFERRING_SITES
ignore-panel KEYPHRASES
ignore-panel STATUS_CODES
ignore-panel REMOTE_USER
ignore-panel GEO_LOCATION
enable-panel VISITORS
enable-panel REQUESTS
enable-panel REQUESTS_STATIC
enable-panel NOT_FOUND
enable-panel STATUS_CODES
- name: Run goaccess
become: yes
shell: |
# We will publish to the zuul homedir for now as that allows us to
# double check the data produced is clean before making it
# public.
OUT_FILE="/home/zuul/{{ goaccess_site }}_goaccess_report.html"
SOURCE_FILE="/var/log/apache2/{{ goaccess_site }}_access.log"
# This pipes in all the compressed logs as well as the current
# uncompressed logs. Giving us a window as wide as our log retention.
( cat ${SOURCE_FILE}{,.1} ; zcat ${SOURCE_FILE}.*.gz ) | goaccess -o $OUT_FILE -p /home/zuul/goaccess.conf -
args:
executable: /bin/bash
# Not using normal zuul job roles as static.opendev.org is not a
# test node with all the normal bits in place.
- name: Collect log output
synchronize:
dest: "{{ zuul.executor.log_root }}/{{ goaccess_site }}_goaccess_report.html"
mode: pull
src: "/home/zuul/{{ goaccess_site }}_goaccess_report.html"
verify_host: true
- name: Return goaccess artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Goaccess report"
url: "{{ goaccess_site }}_goaccess_report.html"
metadata:
type: html_report