Rename mirror/thinlinc to thinlinc_mirror
This commit is contained in:
parent
b7a3415352
commit
affcf7f572
3 changed files with 1 additions and 1 deletions
50
roles/thinlinc_mirror/files/sync-thinlinc-repo.sh
Executable file
50
roles/thinlinc_mirror/files/sync-thinlinc-repo.sh
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
umask 022
|
||||
|
||||
BASEURL="https://www.cendio.com"
|
||||
REPODIR="/srv/mirrors/thinlinc"
|
||||
|
||||
if [ ! -d "${REPODIR}" ]; then
|
||||
echo "ERR: Cannot find repository directory ${REPODIR}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# we only do x86_64
|
||||
REPODIR="${REPODIR}/x86_64"
|
||||
if [ ! -d "${REPODIR}" ]; then
|
||||
mkdir "${REPODIR}"
|
||||
fi
|
||||
|
||||
LOCATION=$(curl -sf "${BASEURL}/thinlinc/download/" | \
|
||||
sed -n 's/^.*<a href="\(.*\.x86_64\.rpm\)".*/\1/p' | head -n 1)
|
||||
if [ "${LOCATION}" = "" ]; then
|
||||
echo "ERR: Failed to determine current thinlinc version" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
PKGNAME="$(basename "${LOCATION}")"
|
||||
|
||||
if [ ! -f "${REPODIR}/${PKGNAME}" ]; then
|
||||
VERSION="$(echo "$PKGNAME" | sed -n 's/^thinlinc-client-\([0-9\.]*\)-[0-9]*\.x86_64\.rpm/\1/p')"
|
||||
|
||||
echo "New thinlinc version ${VERSION} found"
|
||||
echo ""
|
||||
|
||||
tmpfile="$(mktemp)"
|
||||
trap 'rm -f "$tmpfile"' EXIT
|
||||
|
||||
# assume that server version goes in-line with client
|
||||
echo "Downloading server package:"
|
||||
curl -sfo "$tmpfile" "${BASEURL}/downloads/server/tl-${VERSION}-server.zip"
|
||||
echo "Extracting server rpm files:"
|
||||
unzip -jd "$REPODIR" "$tmpfile" \*.rpm
|
||||
|
||||
echo "Downloading client rpm package:"
|
||||
curl -sfo "${REPODIR}/${PKGNAME}" "${LOCATION}"
|
||||
echo ""
|
||||
echo "Updating repository metadata:"
|
||||
createrepo_c "${REPODIR}"
|
||||
echo ""
|
||||
fi
|
41
roles/thinlinc_mirror/tasks/main.yml
Normal file
41
roles/thinlinc_mirror/tasks/main.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
- name: Install required packages
|
||||
ansible.builtin.package:
|
||||
name: "{{ item }}"
|
||||
state: installed
|
||||
with_items:
|
||||
- unzip
|
||||
- createrepo_c
|
||||
|
||||
- name: Create target directory
|
||||
ansible.builtin.file:
|
||||
path: /srv/mirrors/thinlinc
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: mirror
|
||||
group: mirror
|
||||
|
||||
- name: Link target directory
|
||||
ansible.builtin.file:
|
||||
dest: /srv/web/{{ inventory_hostname }}/thinlinc
|
||||
src: /srv/mirrors/thinlinc
|
||||
state: link
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
follow: false
|
||||
|
||||
- name: Copy sync script
|
||||
ansible.builtin.copy:
|
||||
dest: /usr/local/bin/sync-thinlinc-repo
|
||||
src: sync-thinlinc-repo.sh
|
||||
mode: "0755"
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Create sync cron job
|
||||
ansible.builtin.cron:
|
||||
name: sync-thinlinc-repo
|
||||
hour: "4"
|
||||
minute: "5"
|
||||
job: /usr/local/bin/sync-thinlinc-repo
|
||||
user: mirror
|
Loading…
Add table
Add a link
Reference in a new issue