summaryrefslogtreecommitdiff
path: root/per-service
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2016-05-27 22:06:45 +0300
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2016-05-27 19:30:26 +0000
commit33340c0ffb2a28ef12dfeae094692e119ab1c007 (patch)
tree7b1185797ab1e0228c452c7e6604fcaf0ecd332c /per-service
parent8d9702bd942a2197bcede93c80d3e8b746c5dca1 (diff)
downloadansible-playbooks-33340c0ffb2a28ef12dfeae094692e119ab1c007.tar.gz
gerrit: Add new role "gerrit-automate" for automated maintenance cronjobs.
Previously, sync keys, groups cronjob setup was part of "gerrit-setup" role, and that doesn't fit well with task of setting up (pristine) gerrit per se. Also, separate one-line crontabs were used for each job. Use a common crontab for related jobs instead. This change is prerequisite for adding update-gerrit-parents.py cronjob. Change-Id: I30d9185014287203913515a729c1a5c4f214e1c3 Reviewed-on: https://review.linaro.org/12288 Reviewed-by: Andy Doan <andy.doan@linaro.org>
Diffstat (limited to 'per-service')
-rw-r--r--per-service/git-servers/gerrit.yml1
-rw-r--r--per-service/git-servers/roles/gerrit-automate/tasks/main.yml18
-rw-r--r--per-service/git-servers/roles/gerrit-automate/templates/gerrit-automate (renamed from per-service/git-servers/roles/gerrit-setup/templates/ldapgroupscron)3
-rw-r--r--per-service/git-servers/roles/gerrit-setup/tasks/deps.yml30
-rw-r--r--per-service/git-servers/roles/gerrit-setup/templates/ldapkeyscron4
5 files changed, 22 insertions, 34 deletions
diff --git a/per-service/git-servers/gerrit.yml b/per-service/git-servers/gerrit.yml
index 467047a..219b04d 100644
--- a/per-service/git-servers/gerrit.yml
+++ b/per-service/git-servers/gerrit.yml
@@ -22,3 +22,4 @@
- gerrit-theme
- gerrit-hooks
- gerrit-bot-user
+ - gerrit-automate
diff --git a/per-service/git-servers/roles/gerrit-automate/tasks/main.yml b/per-service/git-servers/roles/gerrit-automate/tasks/main.yml
new file mode 100644
index 0000000..b5e64b1
--- /dev/null
+++ b/per-service/git-servers/roles/gerrit-automate/tasks/main.yml
@@ -0,0 +1,18 @@
+- name: Install Gerrit automation crontab
+ template: src=gerrit-automate dest=/etc/cron.d/
+ owner=root
+ group=root
+ mode=0644
+ when: hosttype == "git-review"
+ tags:
+ - cron
+ - install
+ - update
+
+- name: Install update_gerrit_parents.py script config
+ copy: src={{secrets_dir}}/files/update_gerrit_parents_conf.py dest={{tools_checkout_dir}}/linaro-git-tools/
+ owner={{git_user}} mode=0600 backup=yes
+ tags:
+ - secrets
+ - install
+ - update
diff --git a/per-service/git-servers/roles/gerrit-setup/templates/ldapgroupscron b/per-service/git-servers/roles/gerrit-automate/templates/gerrit-automate
index 4dc38f7..450b40b 100644
--- a/per-service/git-servers/roles/gerrit-setup/templates/ldapgroupscron
+++ b/per-service/git-servers/roles/gerrit-automate/templates/gerrit-automate
@@ -1,4 +1,7 @@
MAILTO=linaro-infrastructure-errors@lists.linaro.org
+#Ansible: Update gerrit SSH keys from LDAP
+*/10 * * * * {{git_user}} {{tools_checkout_dir}}/linaro-git-tools/update-gerrit-keys.py --username {{gerrit_http_username}} --base {{gerrit_http_base}}
+
#Ansible: Update gerrit group membership from LDAP
*/60 * * * * {{git_user}} {{tools_checkout_dir}}/linaro-git-tools/update-gerrit-groups.py --username {{gerrit_http_username}} --base {{gerrit_http_base}}
diff --git a/per-service/git-servers/roles/gerrit-setup/tasks/deps.yml b/per-service/git-servers/roles/gerrit-setup/tasks/deps.yml
index 22c170c..c27af63 100644
--- a/per-service/git-servers/roles/gerrit-setup/tasks/deps.yml
+++ b/per-service/git-servers/roles/gerrit-setup/tasks/deps.yml
@@ -28,33 +28,3 @@
owner={{ git_user }}
group={{ git_user }}
mode=0755
-
-- name: Install gerrit LDAP Keys sync crontab
- template: src=ldapkeyscron dest=/etc/cron.d/gerrit-sync-keys
- owner=root
- group=root
- mode=0644
- when: hosttype == "git-review"
- tags:
- - cron
- - install
- - update
-
-- name: Install gerrit LDAP Groups sync crontab
- template: src=ldapgroupscron dest=/etc/cron.d/gerrit-sync-groups
- owner=root
- group=root
- mode=0644
- when: hosttype == "git-review"
- tags:
- - cron
- - install
- - update
-
-- name: Install update_gerrit_parents.py script config
- copy: src={{secrets_dir}}/files/update_gerrit_parents_conf.py dest={{tools_checkout_dir}}/linaro-git-tools/
- owner={{git_user}} mode=0600 backup=yes
- tags:
- - secrets
- - install
- - update
diff --git a/per-service/git-servers/roles/gerrit-setup/templates/ldapkeyscron b/per-service/git-servers/roles/gerrit-setup/templates/ldapkeyscron
deleted file mode 100644
index bd731b6..0000000
--- a/per-service/git-servers/roles/gerrit-setup/templates/ldapkeyscron
+++ /dev/null
@@ -1,4 +0,0 @@
-MAILTO=linaro-infrastructure-errors@lists.linaro.org
-
-#Ansible: Update gerrit SSH keys from LDAP
-*/10 * * * * {{git_user}} {{tools_checkout_dir}}/linaro-git-tools/update-gerrit-keys.py --username {{gerrit_http_username}} --base {{gerrit_http_base}}