summaryrefslogtreecommitdiff
path: root/ansible/mirror-git.yml
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-05-13 17:16:34 +0300
committerLars Wirzenius <liw@liw.fi>2021-05-13 17:16:34 +0300
commit9acbe58646ea92cf63070df4bd9a7aa3f0cdfb13 (patch)
treeeeda6d4f8cdcb130d743273d62266418ff2c9629 /ansible/mirror-git.yml
parente479b2862228b2faf68896da48571307c9211779 (diff)
downloadansibleness-9acbe58646ea92cf63070df4bd9a7aa3f0cdfb13.tar.gz
move mirror-git from Hetzner to local, and automatically clone repos
Diffstat (limited to 'ansible/mirror-git.yml')
-rw-r--r--ansible/mirror-git.yml65
1 files changed, 65 insertions, 0 deletions
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') }}"