From 98ab53ee4206c3a67b2fd6c3b5705cae520ccfac Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 26 Nov 2019 07:22:46 +1100 Subject: [PATCH] rsync mirrors: use localauth vos release We switched Fedora to do vos release via ssh with localauth in I56ecdb2511597197deeeadf51f50da7e02f56954 and it has been working. Switch the rest of the update scripts. There is an increasing amount of common code, start a common functions.sh script where we can put this. Change-Id: I4ba6d64a84bb66e8686901b16010352de942f303 --- .../mirror-update/files/centos-mirror-update | 4 +++- .../roles/mirror-update/files/epel-mirror-update | 4 +++- .../mirror-update/files/fedora-mirror-update | 3 ++- playbooks/roles/mirror-update/files/functions.sh | 5 +++++ .../mirror-update/files/opensuse-mirror-update | 4 +++- .../files/yum-puppetlabs-mirror-update | 4 +++- playbooks/roles/mirror-update/tasks/rsync.yaml | 16 ++++++++++++++++ 7 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 playbooks/roles/mirror-update/files/functions.sh diff --git a/playbooks/roles/mirror-update/files/centos-mirror-update b/playbooks/roles/mirror-update/files/centos-mirror-update index 95e0919f9a..2e1914a9f1 100755 --- a/playbooks/roles/mirror-update/files/centos-mirror-update +++ b/playbooks/roles/mirror-update/files/centos-mirror-update @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +source /usr/share/mirror-update/functions.sh + MIRROR_VOLUME=$1 if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then @@ -91,7 +93,7 @@ done date --iso-8601=ns | $K5START tee $BASE/timestamp.txt echo "rsync completed successfully, running vos release." -k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v $MIRROR_VOLUME +$VOS_RELEASE $MIRROR_VOLUME date --iso-8601=ns echo "Done." diff --git a/playbooks/roles/mirror-update/files/epel-mirror-update b/playbooks/roles/mirror-update/files/epel-mirror-update index e98ef73c6c..63b38c744d 100755 --- a/playbooks/roles/mirror-update/files/epel-mirror-update +++ b/playbooks/roles/mirror-update/files/epel-mirror-update @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +source /usr/share/mirror-update/functions.sh + MIRROR_VOLUME=$1 if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then @@ -88,7 +90,7 @@ echo "$SHA1SUM $BASE/$REPO/$REPOMD" | sha1sum -c - date --iso-8601=ns | $K5START tee $BASE/timestamp.txt echo "rsync completed successfully, running vos release." -k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v $MIRROR_VOLUME +$VOS_RELEASE $MIRROR_VOLUME date --iso-8601=ns echo "Done." diff --git a/playbooks/roles/mirror-update/files/fedora-mirror-update b/playbooks/roles/mirror-update/files/fedora-mirror-update index 0fef6ca32a..55ff7e824b 100755 --- a/playbooks/roles/mirror-update/files/fedora-mirror-update +++ b/playbooks/roles/mirror-update/files/fedora-mirror-update @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +source /usr/share/mirror-update/functions.sh + MIRROR_VOLUME=$1 function echo_ts { @@ -37,7 +39,6 @@ BASE="/afs/.openstack.org/mirror/fedora" # https://pagure.io/releng/issue/7921 MIRROR="rsync://pubmirror2.math.uh.edu/fedora-buffet/fedora/linux" K5START="k5start -t -f /etc/fedora.keytab service/fedora-mirror -- ${TIMEOUT}" -VOS_RELEASE="ssh -i /root/.ssh/id_vos_release vos_release@afs01.dfw.openstack.org vos release " echo_ts "----- START FEDORA MIRROR RSYNC RUN -----" diff --git a/playbooks/roles/mirror-update/files/functions.sh b/playbooks/roles/mirror-update/files/functions.sh new file mode 100644 index 0000000000..9fefd29ef3 --- /dev/null +++ b/playbooks/roles/mirror-update/files/functions.sh @@ -0,0 +1,5 @@ +# +# Common definitions and functions for mirror-update scripts +# + +VOS_RELEASE="ssh -i /root/.ssh/id_vos_release vos_release@afs01.dfw.openstack.org vos release " diff --git a/playbooks/roles/mirror-update/files/opensuse-mirror-update b/playbooks/roles/mirror-update/files/opensuse-mirror-update index e55204fa40..424aa3e99c 100755 --- a/playbooks/roles/mirror-update/files/opensuse-mirror-update +++ b/playbooks/roles/mirror-update/files/opensuse-mirror-update @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +source /usr/share/mirror-update/functions.sh + MIRROR_VOLUME=$1 if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then @@ -131,7 +133,7 @@ $K5START rsync -rlptDvz \ date --iso-8601=ns | $K5START tee $BASE/timestamp.txt echo "rsync completed successfully, running vos release." -k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v $MIRROR_VOLUME +$VOS_RELEASE $MIRROR_VOLUME date --iso-8601=ns echo "Done." diff --git a/playbooks/roles/mirror-update/files/yum-puppetlabs-mirror-update b/playbooks/roles/mirror-update/files/yum-puppetlabs-mirror-update index eebafc75ae..6ef69b192e 100755 --- a/playbooks/roles/mirror-update/files/yum-puppetlabs-mirror-update +++ b/playbooks/roles/mirror-update/files/yum-puppetlabs-mirror-update @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +source /usr/share/mirror-update/functions.sh + MIRROR_VOLUME=$1 if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then @@ -58,7 +60,7 @@ $K5START rsync -rlptDvz \ date --iso-8601=ns | $K5START tee $BASE/timestamp.txt echo "rsync completed successfully, running vos release." -k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v $MIRROR_VOLUME +$VOS_RELEASE $MIRROR_VOLUME date --iso-8601=ns echo "Done." diff --git a/playbooks/roles/mirror-update/tasks/rsync.yaml b/playbooks/roles/mirror-update/tasks/rsync.yaml index fbf49e326f..daaaffa37d 100644 --- a/playbooks/roles/mirror-update/tasks/rsync.yaml +++ b/playbooks/roles/mirror-update/tasks/rsync.yaml @@ -8,6 +8,22 @@ group: root mode: '0755' +- name: Create common function dir + file: + path: /usr/share/mirror-update + state: directory + owner: root + group: root + mode: '0755' + +- name: Copy in common functions + copy: + src: 'functions.sh' + dest: '/usr/share/mirror-update' + owner: root + group: root + mode: '0644' + - name: Set update script names set_fact: rsync_update_scripts: