Add cronjob to update the website translation

This commit is contained in:
Michael Scherer 2021-01-13 21:24:07 +01:00 committed by misc
parent f9abb293c0
commit 8548f299ca
4 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,2 @@
MAILTO=jibecfed
0 22 * * * _update_web_trans /usr/local/bin/lock-wrapper cron-web-translation-update "/usr/local/bin/web-translation-update"

View file

@ -0,0 +1,3 @@
Host pagure.io
IdentityFile ~/.ssh/id_rsa_web_trans
StrictHostKeyChecking no

View file

@ -0,0 +1,17 @@
#!/bin/bash
OLD=$(mktemp -d -t fedora_web_trans_XXXX)
cd $OLD
function clean_tmp() {
[ -n "$OLD" ] && rm -Rf "$OLD"
}
trap clean_tmp exit
git clone https://pagure.io/fedora-websites.git
cd fedora-websites
for i in *fedoraproject.org; do
( cd $i ; make pushpot )
done

View file

@ -0,0 +1,50 @@
- name: Install packages
package:
name:
- babel
- git
- python-genshi
state: present
tags:
- fedora-web-translation
- name: Create a non root user to run the code
user:
name: _update_web_trans
generate_ssh_key: yes
ssh_key_file: .ssh/id_rsa_web_trans
register: user_result
tags:
- fedora-web-translation
- name: Display the public key to add it to pagure
debug:
var: user_result.ssh_public_key
- copy:
src: ssh_config
dest: ~_update_web_trans/.ssh/config
owner: _update_web_trans
group: _update_web_trans
mode: 0644
tags:
- fedora-web-translation
- copy:
src: web-translation-update
dest: /usr/local/bin/web-translation-update
owner: root
group: root
mode: 0755
tags:
- fedora-web-translation
- copy:
src: cron-web-translation-update
dest: /etc/cron.d/cron-web-translation-update
owner: root
group: root
mode: 0644
tags:
- fedora-web-translation
when: env == "production" and inventory_hostname.startswith('sundries01')