add tools for syncing thinlinc packages and enable it on mirror group
This commit is contained in:
parent
278f2deb92
commit
79dd378265
3 changed files with 74 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
roles:
|
||||
- base
|
||||
- mirror/base
|
||||
- mirror/thinlinc
|
||||
- role: mirror/sync
|
||||
label: fedora-epel
|
||||
source: "rsync://rsync.nic.funet.fi/ftp/pub/mirrors/fedora.redhat.com/pub/epel"
|
||||
|
|
41
roles/mirror/thinlinc/files/sync-thinlinc-repo
Executable file
41
roles/mirror/thinlinc/files/sync-thinlinc-repo
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
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
|
||||
|
||||
LOCATION=$(curl -s "${BASEURL}/thinlinc/download" | \
|
||||
sed -n 's/^.*<a href="\(.*\.x86_64\.rpm\)">64-bit.*/\1/p')
|
||||
if [ "${LOCATION}" = "" ]; then
|
||||
echo "ERR: Failed to determine current thinlinc version" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
PKGNAME="$(basename "${LOCATION}")"
|
||||
|
||||
if [ ! -f "${REPODIR}/${PKGNAME}" ]; then
|
||||
echo "New thinlinc version found"
|
||||
echo ""
|
||||
|
||||
# assume that server version goes in-line with client
|
||||
echo "Downloading server package:"
|
||||
curl -o "${REPODIR}/.server.zip" "${BASEURL}/downloads/server/download.py"
|
||||
echo "Extracting server rpm files:"
|
||||
unzip -jd ${REPODIR} ${REPODIR}/.server.zip \*.rpm
|
||||
echo "Cleaning up..."
|
||||
rm -f ${REPODIR}/.server.zip
|
||||
echo ""
|
||||
|
||||
echo "Downloading client rpm package:"
|
||||
curl -o "${REPODIR}/${PKGNAME}" "${BASEURL}${LOCATION}"
|
||||
echo ""
|
||||
echo "Updating repository metadata:"
|
||||
createrepo_c "${REPODIR}"
|
||||
echo ""
|
||||
fi
|
||||
|
32
roles/mirror/thinlinc/tasks/main.yml
Normal file
32
roles/mirror/thinlinc/tasks/main.yml
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
- name: install required packages
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: installed
|
||||
with_items:
|
||||
- unzip
|
||||
- createrepo_c
|
||||
|
||||
- name: create target directory
|
||||
file:
|
||||
path: /srv/mirrors/thinlinc
|
||||
state: directory
|
||||
mode: 0755
|
||||
owner: mirror
|
||||
group: mirror
|
||||
|
||||
- name: copy sync script
|
||||
copy:
|
||||
dest: /usr/local/bin/sync-thinlinc-repo
|
||||
src: sync-thinlinc-repo
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: create sync cron job
|
||||
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