Add flag to allow skipping docker-compose up

For our rollout, we need to be able to run this without actually
running the up.

Also, split out startup tasks so that we can run them from a
dedicated start playbook by themselves.

Change-Id: I08d994e496fbd8d5adbfa1ce344b0ae52f46535c
This commit is contained in:
Monty Taylor 2020-03-19 11:22:06 -05:00
parent 316efe74b1
commit 2e5b95a7f3
6 changed files with 31 additions and 16 deletions

View File

@ -2,6 +2,7 @@ gerrit_id: 3000
gerrit_user_name: gerrit2
gerrit_home_dir: /home/gerrit2
gerrit_site_dir: "{{ gerrit_home_dir }}/review_site"
gerrit_run_compose_up: false
gerrit_run_init: false
gerrit_container_image: docker.io/opendevorg/gerrit:2.13
gerrit_container_volumes:

View File

@ -272,19 +272,5 @@
- docker-compose
state: present
# TODO(mordred) Make this suck less, like if we could do an init container
# or something just generally less gross.
- name: Run gerrit init
when: gerrit_run_init | bool
command: >
docker run --rm --net=host -u gerrit
{% for volume in gerrit_container_volumes %}
-v {{ volume }}
{% endfor %}
{{ gerrit_container_image }}
/usr/local/openjdk-8/bin/java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit -b --no-auto-start --install-all-plugins
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/gerrit-compose/
- name: Start gerrit
include_tasks: start.yaml

View File

@ -0,0 +1,17 @@
# TODO(mordred) Make this suck less, like if we could do an init container
# or something just generally less gross.
- name: Run gerrit init
when: gerrit_run_init | bool
command: >
docker run --rm --net=host -u gerrit
{% for volume in gerrit_container_volumes %}
-v {{ volume }}
{% endfor %}
{{ gerrit_container_image }}
/usr/local/openjdk-8/bin/java -jar /var/gerrit/bin/gerrit.war init -d /var/gerrit -b --no-auto-start --install-all-plugins
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/gerrit-compose/
when: gerrit_run_compose_up | bool

View File

@ -0,0 +1,9 @@
- hosts: review
name: "start gerrit"
tasks:
- include_role:
name: gerrit
vars:
gerrit_run_init: true
gerrit_run_compose_up: true
tasks_from: start

View File

@ -86,6 +86,7 @@ gerrit_dev_replication_ssh_rsa_key_contents: |
-----END OPENSSH PRIVATE KEY-----
gerrit_dev_replication_ssh_rsa_pubkey_contents: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgmL6EBuMLoOyf6c56XmVKmZSzZoWaXniuJHvawj97eEs3vtBIJRNMI1lGP4BlnpGeKM10IJxMZmsUo52leytrr+9hW7e4Wjao/T3CsS6JiEdLThweEZWiTGTlULeJDqgnvC6tUoxw6zUbG50t5wtLzJW9WFdaNaysWJODVVEIfFwYe/irmso0TGfW5U76NEGCnTd03Wd9GaudMnIvOKDPeq8H4VgfC70WixNPXe6JR7Ca5w4hj/GUrEnenGFLZgOk6Gu68CuKvyIh4kmy+gJQlwTLSry9WWbYZmsp1pyJU6NdTb4829sJYydx0/bjpWZ+JrXCFN2peczeGQW4hjEd gerrit-code-review-dev-replication
gerrit_database_type: h2
gerrit_run_compose_up: true
gerrit_run_init: true
gerrit_dev_storyboard_token: 4020000c-d1b9-4173-ab33-2f55dbc1c718
gerrit_dev_email_private_key: xxj2lTapostsobbxvpawhjhnzufaGxchrypoddcafqarrq5h

View File

@ -86,6 +86,7 @@ gerrit_replication_ssh_rsa_key_contents: |
-----END OPENSSH PRIVATE KEY-----
gerrit_replication_ssh_rsa_pubkey_contents: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQhZQ0z+RVPmOzY2f56N9/PrqDeHftvnagPJyOOXnCd/9N0j+stFWNmavvb8y4dRZ+y6lOJpzPYEahwUUXZHAanz5l5as+VihWq7ldcMxSPnmkC9zr65Z8eNDcM2Bzk8gx5e4DE6OgpWkc6ke9MpwI5dmfW7o53gQZkdSc94TuLr+ZCYUKo7fScsVeE+F9dT0PLyW0zU7c23PzYnkKcrB9ihpQfSfbJj9EAtsA3aA8ZdHt78i5r7+0u0JZxaWoKjkCfYqC8ofbTU61YuUO8TTgNgMC6ZzBmTRdRRRKdGun+m1fqtgIqPSi+iZpKnERgg/hPwY+gqcKh+svW6pgCDhJ gerrit-code-review-replication
gerrit_database_type: h2
gerrit_run_compose_up: true
gerrit_run_init: true
gerrit_storyboard_token: 52514e74-4b8f-4d6d-a29a-a6262f97578a
gerrit_email_private_key: wjpkxebohgbid6rpuwpfrYsouxpgseluqir6yupppBczoezj