summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--per-service/git-servers/group_vars/all1
-rw-r--r--per-service/git-servers/roles/gerrit-setup/tasks/gerrit.yml11
2 files changed, 9 insertions, 3 deletions
diff --git a/per-service/git-servers/group_vars/all b/per-service/git-servers/group_vars/all
index c86ced6..1ea4a85 100644
--- a/per-service/git-servers/group_vars/all
+++ b/per-service/git-servers/group_vars/all
@@ -22,6 +22,7 @@ www_host: "{{inventory_hostname}}"
gerrit_plugin_version: 2.14 # Adjust only major version, so 2.12, 2.13 etc.
gerrit_managed: no
gerrit_version: 2.14.5.1
+gerrit_checksum: md5:f2c0d595d0b2faca431f427dc718526c
gerrit_download_link: https://gerrit-releases.storage.googleapis.com/gerrit-{{gerrit_version}}.war
gerrit_root: /srv/gerrit
db_name: reviewdb
diff --git a/per-service/git-servers/roles/gerrit-setup/tasks/gerrit.yml b/per-service/git-servers/roles/gerrit-setup/tasks/gerrit.yml
index 8828272..a6395a6 100644
--- a/per-service/git-servers/roles/gerrit-setup/tasks/gerrit.yml
+++ b/per-service/git-servers/roles/gerrit-setup/tasks/gerrit.yml
@@ -8,7 +8,8 @@
file: path={{gerrit_root}} owner={{git_user}} group={{git_user}} mode=0755 state=directory
- name: Download Gerrit
- get_url: url={{gerrit_download_link}} dest={{gerrit_root}}/gerrit.war mode=0750 owner={{git_user}} group={{git_user}}
+ get_url: url={{gerrit_download_link}} dest={{gerrit_root}}/gerrit.war mode=0750 owner={{git_user}} group={{git_user}} checksum={{gerrit_checksum}}
+ register: gerrit_downloaded
tags:
- gerrit-conf
@@ -17,11 +18,15 @@
register: gerrit_initialized
ignore_errors: True
+- name: Ensure currently running version is stopped after a download.
+ service: name=gerrit state=stopped
+ when: gerrit_downloaded.changed
+
- name: Initialize Gerrit
become: true
become_user: "{{git_user}}"
command: chdir={{gerrit_root}} java -jar gerrit.war init --batch --no-auto-start -d {{gerrit_root}}
- when: gerrit_initialized.stat.exists == False
+ when: gerrit_initialized.stat.exists == False or gerrit_downloaded.changed
- name: Create Gerrit.conf
template: src="files/gerrit/{{gerrit_host}}" dest={{gerrit_root}}/etc/gerrit.config owner={{git_user}} group={{git_user}}
@@ -42,7 +47,7 @@
become: true
become_user: "{{git_user}}"
command: chdir={{gerrit_root}} java -jar bin/gerrit.war init --batch --no-auto-start -d {{gerrit_root}}
- when: gerrit_conf.changed
+ when: gerrit_conf.changed or gerrit_downloaded.changed
tags:
- gerrit-conf
notify: