1
1
Fork 0
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2024-06-09 21:16:05 +02:00
infrastructure/roles/dbscripts/tasks/main.yml

162 lines
6.7 KiB
YAML
Raw Normal View History

2016-05-29 16:22:44 +02:00
---
2016-06-01 12:21:15 +02:00
- name: install svn, git, rsync and some perl stuff
pacman: name=git,subversion,rsync,perl-dbd-pg state=present
2016-05-29 16:22:44 +02:00
- name: create dbscripts users
user: name="{{ item }}" shell=/bin/bash
2016-05-29 16:22:44 +02:00
with_items:
- svn-packages
- svn-community
2016-05-31 11:56:58 +02:00
- name: add cleanup user
user: name=cleanup groups=tu,dev,multilib shell=/sbin/nologin
2016-05-29 16:22:44 +02:00
- name: add sourceballs user
user: name=sourceballs shell=/sbin/nologin
- name: create Arch Linux-specific users
user:
name: "{{ item.key }}"
group: users
groups: "{{ item.value.groups | join(',') }}"
comment: "{{ item.value.name}}"
state: present
with_dict: "{{ arch_users }}"
- name: gather pubkeys for all devs
set_fact: dev_pubkey_list="command=\"/usr/bin/svnserve --tunnel-user='{{ item.key }}' -t\",no-port-forwarding,no-agent-forwarding,no-pty {{ lookup('file', '../pubkeys/' + item.value.ssh_key)}}"
register: dev_pubkeys
when: "\"dev\" in item.value.groups"
with_dict: "{{ arch_users }}"
- name: join all dev pubkeys into a big string
set_fact: dev_pubkey_string="{% for key in dev_pubkeys.results %}{{ key.ansible_facts.dev_pubkey_list + '\n' if 'ansible_facts' in key else '' }}{% endfor %}"
- name: gather pubkeys for all tus
set_fact: tu_pubkey_list="command=\"/usr/bin/svnserve --tunnel-user='{{ item.key }}' -t\",no-port-forwarding,no-agent-forwarding,no-pty {{ lookup('file', '../pubkeys/' + item.value.ssh_key)}}"
register: tu_pubkeys
when: "\"tu\" in item.value.groups"
with_dict: "{{ arch_users }}"
- name: join all tu pubkeys into a big string
set_fact: tu_pubkey_string="{% for key in tu_pubkeys.results %}{{ key.ansible_facts.tu_pubkey_list + '\n' if 'ansible_facts' in key else '' }}{% endfor %}"
- name: configure ssh keys for devs
authorized_key:
user: svn-packages
key: "{{ dev_pubkey_string }}"
manage_dir: yes
state: present
exclusive: yes
2016-05-31 11:56:58 +02:00
- name: configure ssh keys for TUs
authorized_key:
user: svn-community
key: "{{ tu_pubkey_string }}"
manage_dir: yes
state: present
exclusive: yes
2016-05-29 16:22:44 +02:00
- name: create dbscripts paths
file: path="{{ item }}" state=directory
with_items:
- /srv/repos/svn-community
- /srv/repos/svn-packages
- file: path="/srv/repos/svn-community/package-cleanup" state=directory owner=svn-community group=tu mode=0775
- acl: name=/srv/repos/svn-community/package-cleanup entry="user:cleanup:rwx" state=present
- acl: name=/srv/repos/svn-community/package-cleanup entry="default:user::rwx" state=present
- acl: name=/srv/repos/svn-community/package-cleanup entry="default:user:cleanup:rwx" state=present
- acl: name=/srv/repos/svn-community/package-cleanup entry="default:group::rwx" state=present
- acl: name=/srv/repos/svn-community/package-cleanup entry="default:other::r-x" state=present
- file: path="/srv/repos/svn-packages/package-cleanup" state=directory owner=svn-packages group=dev mode=0775
- acl: name=/srv/repos/svn-packages/package-cleanup entry="user:cleanup:rwx" state=present
- acl: name=/srv/repos/svn-packages/package-cleanup entry="default:user::rwx" state=present
- acl: name=/srv/repos/svn-packages/package-cleanup entry="default:user:cleanup:rwx" state=present
- acl: name=/srv/repos/svn-packages/package-cleanup entry="default:group::rwx" state=present
- acl: name=/srv/repos/svn-packages/package-cleanup entry="default:other::r-x" state=present
- file: path="/srv/repos/svn-community/source-cleanup" state=directory owner=sourceballs group=svn-community mode=0755
- file: path="/srv/repos/svn-packages/source-cleanup" state=directory owner=sourceballs group=svn-packages mode=0755
- file: path="/srv/repos/svn-community/svn" state=directory owner=svn-community group=svn-community mode=0755
- acl: name=/srv/repos/svn-community/svn entry="default:user::rwx" state=present
- acl: name=/srv/repos/svn-community/svn entry="default:group::r-x" state=present
- acl: name=/srv/repos/svn-community/svn entry="default:other::r-x" state=present
- file: path="/srv/repos/svn-packages/svn" state=directory owner=svn-packages group=svn-packages mode=0755
- acl: name=/srv/repos/svn-packages/svn entry="default:user::rwx" state=present
- acl: name=/srv/repos/svn-packages/svn entry="default:group::r-x" state=present
- acl: name=/srv/repos/svn-packages/svn entry="default:other::r-x" state=present
- file: path="/srv/repos/svn-community/tmp" state=directory owner=svn-community group=tu mode=1775
- acl: name=/srv/repos/svn-community/tmp entry="user:sourceballs:rwx" state=present
- file: path="/srv/repos/svn-packages/tmp" state=directory owner=svn-packages group=dev mode=1775
- acl: name=/srv/repos/svn-packages/tmp entry="user:sourceballs:rwx" state=present
- file: path="/srv/ftp/lastupdate" state=touch owner=ftp group=ftp mode=0644
- acl: name=/srv/ftp/lastupdate entry="group:tu:rw-" state=present
- acl: name=/srv/ftp/lastupdate entry="group:dev:rw-" state=present
2016-05-29 16:22:44 +02:00
- name: clone dbscripts git repo
git: dest=/srv/repos/{{ item }}/dbscripts repo=https://git.archlinux.org/dbscripts.git
2016-05-29 16:22:44 +02:00
with_items:
- svn-community
- svn-packages
- name: make /srv/svn
file: path=/srv/svn state=directory
- name: symlink /srv/svn/community to /srv/repos/svn-community/svn
file: path=/srv/svn/community src=/srv/repos/svn-community/svn state=link
- name: symlink /srv/svn/packages to /srv/repos/svn-packages/svn
file: path=/srv/svn/packages src=/srv/repos/svn-packages/svn state=link
- name: symlink /community to /srv/repos/svn-community/dbscripts
file: path=/community src=/srv/repos/svn-community/dbscripts state=link
- name: symlink /packages to /srv/repos/svn-packages/dbscripts
file: path=/packages src=/srv/repos/svn-packages state=link
2016-06-01 12:21:15 +02:00
- name: create rsyncd-conf-genscripts
file: path=/etc/rsyncd-conf-genscripts state=directory owner=root group=root mode=700
- name: install rsync.conf.proto
copy: src=rsyncd.conf.proto dest=/etc/rsyncd-conf-genscripts/rsyncd.conf.proto owner=root group=root mode=644
- name: configure gen_rsyncd.conf.pl
template: src=gen_rsyncd.conf.pl dest=/etc/rsyncd-conf-genscripts/gen_rsyncd.conf.pl owner=root group=root mode=700
- name: generate mirror config
command: /etc/rsyncd-conf-genscripts/gen_rsyncd.conf.pl
- name: start rsync
service: name=rsyncd.socket enabled=yes state=started
2016-05-29 16:22:44 +02:00
- name: install systemd timers
copy: src={{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=644
with_items:
- cleanup.timer
- cleanup.service
- sourceballs.timer
- sourceballs.service
- integrity-check.timer
- integrity-check.service
- lastsync.timer
- lastsync.service
2016-06-01 12:21:15 +02:00
- gen_rsyncd.timer
- gen_rsyncd.service
2016-05-29 16:22:44 +02:00
- name: activate systemd timers
2016-05-29 16:22:44 +02:00
service: name={{ item }} enabled=yes state=started
with_items:
- cleanup.timer
- sourceballs.timer
- integrity-check.timer
- lastsync.timer
2016-06-01 12:21:15 +02:00
- gen_rsyncd.timer