Skip to content
Snippets Groups Projects
Commit d00a59ac authored by Morten Linderud's avatar Morten Linderud :surfer: Committed by Kristian Klausen
Browse files

Added syncdebug role

parent 194bc84b
No related branches found
No related tags found
1 merge request!168debuginfod: Implement role
......@@ -91,6 +91,15 @@ hosts deny = *
secrets file = /etc/rsyncd.secrets
max connections = 0
# Debug repositories
[debug_packages]
path = /srv/ftp
comment = debug packages
exclude = *
include = /pool /pool/*-debug/***
hosts allow = {{ hostvars['debuginfod.archlinux.org']['ipv4_address'] }} {{ hostvars['debuginfod.archlinux.org']['ipv6_address'] }}
max connections = 0
# Individual repositories
[core]
path = /srv/ftp/core
......
#!/bin/bash
target="/srv/ftp"
lock="/var/lock/syncdebug.lck"
source_url='rsync://rsync.archlinux.org/debug_packages'
lastupdate_url='https://rsync.archlinux.org/lastupdate'
[ ! -d "${target}" ] && mkdir -p "${target}"
exec 9>"${lock}"
flock -n 9 || exit
rsync_cmd() {
local -a cmd=(rsync -rlptH --safe-links --delete-delay --delay-updates
"--timeout=600" "--contimeout=60" --no-motd)
if stty &>/dev/null; then
cmd+=(-h -v --progress)
else
cmd+=("--info=name1")
fi
"${cmd[@]}" "$@"
}
# if we are called without a tty (cronjob) only run when there are changes
if ! tty -s && [[ -f "$target/lastupdate" ]] && diff -b <(curl -Ls "$lastupdate_url") "$target/lastupdate" >/dev/null; then
exit 0
fi
rsync_cmd \
--exclude=".well-known" \
"${source_url}" \
"${target}"
[Unit]
Description=Synchronize debug packages
RequiresMountsFor=/srv/ftp
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/syncdebug
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7
[Unit]
Description=Sync debug packages every 4 hours
[Timer]
OnCalendar=00/4:00
AccuracySec=1m
Persistent=true
[Install]
WantedBy=timers.target
---
- name: install rsync
pacman: name=rsync state=present
- name: install syncdebug script
copy: src=syncdebug dest=/usr/local/bin/syncdebug owner=root group=root mode=0755
- name: install syncdebug units
copy: src={{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644
with_items:
- syncdebug.timer
- syncdebug.service
- name: start and enable syncdebug units
systemd:
name: "{{ item }}"
enabled: true
state: started
daemon_reload: true
with_items:
- syncdebug.timer
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment