From 9acbe58646ea92cf63070df4bd9a7aa3f0cdfb13 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 13 May 2021 17:16:34 +0300 Subject: move mirror-git from Hetzner to local, and automatically clone repos --- ansible/mirror-git.yml | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 ansible/mirror-git.yml (limited to 'ansible/mirror-git.yml') diff --git a/ansible/mirror-git.yml b/ansible/mirror-git.yml new file mode 100644 index 0000000..049ffb2 --- /dev/null +++ b/ansible/mirror-git.yml @@ -0,0 +1,65 @@ +- hosts: mirror-git + remote_user: debian + become: yes + roles: + - role: sane_debian_system + - role: unix_users + - role: self-updating-system + - smarthost-client + tasks: + - name: "install git and more" + apt: + state: present + name: + - git + - moreutils + - psmisc + + - name: "install list of repositories to mirror" + copy: + src: mirror-list + dest: /etc/mirror-git.list + + - name: "install script to mirror gitlab to git.liw.fi" + copy: + src: mirror-git.sh + dest: /usr/local/bin/gitlab-to-git.liw.fi + mode: 0755 + + - name: "set up cron job to mirror git" + cron: + name: "mirror git" + user: liw + hour: "*" + minute: "*/5" + job: | + chronic /usr/local/bin/gitlab-to-git.liw.fi + vars: + sane_debian_system_version: 2 + unix_users_version: 2 + + sane_debian_system_hostname: mirror-git + sane_debian_system_codename: buster + sane_debian_system_mirror: deb.debian.org + + unix_users: + - username: root + authorized_keys: | + {{ liw_ssh_pub }} + - username: liw + comment: Lars Wirzenius + sudo: true + authorized_keys: | + {{ liw_ssh_pub }} + ssh_key: | + {{ lookup('pipe', 'pass show ssh/liw@mirror-git') }} + ssh_key_pub: | + {{ lookup('pipe', 'pass show ssh/liw@mirror-git.pub') }} + + mailname: mirror-git.vm.liw.fi + + hostname: "{{ sane_debian_system_hostname }}" + relayhost: pieni.net:587 + smarthost: pieni.net + smarthost_user: pienirelay + smarthost_password: "{{ lookup('pipe', 'pass show pieni.net/pienirelay') }}" -- cgit v1.2.1