From 12f654bb1315d6cee0071e4247f8195acd8f74c5 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Sun, 12 May 2019 23:55:21 +0300 Subject: [PATCH] add fedora report_mirror tool and enable it --- playbooks/mirror.yml | 10 +++ roles/mirror/reportmirror/defaults/main.yml | 4 + roles/mirror/reportmirror/tasks/main.yml | 14 ++++ .../templates/report_mirror.conf.j2 | 84 +++++++++++++++++++ 4 files changed, 112 insertions(+) create mode 100644 roles/mirror/reportmirror/defaults/main.yml create mode 100644 roles/mirror/reportmirror/tasks/main.yml create mode 100644 roles/mirror/reportmirror/templates/report_mirror.conf.j2 diff --git a/playbooks/mirror.yml b/playbooks/mirror.yml index 35998a8..3051de6 100644 --- a/playbooks/mirror.yml +++ b/playbooks/mirror.yml @@ -6,6 +6,9 @@ user: root gather_facts: true + vars_files: + - /srv/ansible-private/vars.yml + pre_tasks: - name: mount /export mount: @@ -21,6 +24,11 @@ - base - mirror/base - mirror/thinlinc + - role: mirror/reportmirror + hostname: mirrors.foo.sh + mirrors: [ epel, fedora ] + sitename: foo.sh + password: "{{ report_mirror_pass }}" - role: mirror/sync label: fedora-epel source: "rsync://rsync.nic.funet.fi/ftp/pub/mirrors/fedora.redhat.com/pub/epel" @@ -28,6 +36,7 @@ - "--exclude=SRPMS" - "--exclude=debug" - "--delete-excluded" + postcmd: /usr/bin/report_mirror - role: mirror/sync label: fedora source: "rsync://rsync.nic.funet.fi/ftp/pub/mirrors/fedora.redhat.com/pub/fedora/linux/" @@ -42,6 +51,7 @@ - "--exclude=armhfp" - "--exclude=debug" - "--delete-excluded" + postcmd: /usr/bin/report_mirror - role: mirror/sync label: openbsd source: "rsync://ftp.eenet.ee/OpenBSD/" diff --git a/roles/mirror/reportmirror/defaults/main.yml b/roles/mirror/reportmirror/defaults/main.yml new file mode 100644 index 0000000..c2ae745 --- /dev/null +++ b/roles/mirror/reportmirror/defaults/main.yml @@ -0,0 +1,4 @@ +--- + +hostname: "{{ inventory_hostname }}" +mirrors: [] diff --git a/roles/mirror/reportmirror/tasks/main.yml b/roles/mirror/reportmirror/tasks/main.yml new file mode 100644 index 0000000..222633d --- /dev/null +++ b/roles/mirror/reportmirror/tasks/main.yml @@ -0,0 +1,14 @@ +--- + +- name: install reportmirror packages + package: + name: mirrormanager2-client + state: installed + +- name: create reportmirror config from template + template: + dest: /etc/mirrormanager-client/report_mirror.conf + src: report_mirror.conf.j2 + mode: 0640 + owner: root + group: mirror diff --git a/roles/mirror/reportmirror/templates/report_mirror.conf.j2 b/roles/mirror/reportmirror/templates/report_mirror.conf.j2 new file mode 100644 index 0000000..ae793f3 --- /dev/null +++ b/roles/mirror/reportmirror/templates/report_mirror.conf.j2 @@ -0,0 +1,84 @@ +[global] +# if enabled=0, no data is sent to the database +enabled=1 +# server= is the URL to the MirrorManager XML-RPC interface +server=https://admin.fedoraproject.org/mirrormanager/xmlrpc + + +[site] +# if enabled=0, no data about this site is sent to the database +enabled=1 +# Name and Password fields need to match the Site name and password +# fields you entered for your Site in the MirrorManager database at +# https://admin.fedoraproject.org/mirrormanager +name={{ sitename }} +password={{ password }} + +[host] +# if enabled=0, no data about this host is sent to the database +enabled=1 +# Name field need to match the Host name field you entered for your +# Host in the MirrorManager database at +# https://admin.fedoraproject.org/mirrormanager +name={{ hostname }} +# if user_active=0, no data about this category is given to the public +# This can be used to toggle between serving and not serving data, +# such enabled during the nighttime (when you have more idle bandwidth +# available) and disabled during the daytime. +# By not specifying user_active, the database will not be updated. +# user_active=1 + +[stats] +# Stats are only sent when run with the -s option +# and when this section is enabled. +# This feature is not presently implemented +enabled=0 +apache=/var/log/httpd/access_log +vsftpd=/var/log/vsftpd.log +# remember to enable log file and transfer logging in rsyncd.conf +rsyncd=/var/log/rsyncd.log + + +# Content Categories +# These sections match the Categories for content tracked by MirrorManager. +# +# enabled=1 means information about this category will be sent to the database. +# enabled=0, no data about this host is sent to the database. If the +# database already has information for you for this Category, it will +# remain unchanged. This can be used to update the database after you +# have manually synced some infrequently-updated content, such as +# historical releases. +# +# path= is the path on your local disk to the top-level directory for this Category + +[Fedora Linux] +{% if "fedora" in mirrors %} +enabled=1 +{% else %} +enabled=0 +{% endif %} +path=/srv/mrirors/fedora + +[Fedora EPEL] +{% if "epel" in mirrors %} +enabled=1 +{% else %} +enabled=0 +{% endif %} +path=/srv/mirrors/fedora-epel + +# lesser used categories below + +[Fedora Secondary Arches] +enabled=0 +path=/var/www/html/pub/fedora-secondary + +[Fedora Other] +enabled=0 +path=/var/www/html/pub/alt + +# historical content + +[Fedora Archive] +enabled=0 +path=/var/www/html/pub/fedora-archive