2018-05-02 21:24:42 +00:00
|
|
|
- hosts: review
|
2015-04-18 15:31:01 +00:00
|
|
|
gather_facts: False
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
2018-03-23 17:03:28 +00:00
|
|
|
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
|
|
|
|
- name: Stop Gerrit
|
2020-03-20 12:26:42 +00:00
|
|
|
shell:
|
|
|
|
cmd: docker-compose down
|
|
|
|
chdir: /etc/gerrit-compose/
|
2018-03-23 17:03:28 +00:00
|
|
|
|
2019-04-24 15:37:36 +00:00
|
|
|
- name: Make organization dir
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
path: "{{ (item[0] + item[1].new) | dirname }}"
|
|
|
|
group: gerrit2
|
|
|
|
owner: gerrit2
|
|
|
|
mode: 0755
|
2018-03-23 17:03:28 +00:00
|
|
|
with_nested:
|
2020-10-16 16:39:31 +00:00
|
|
|
- [ '~gerrit2/review_site/git/' ]
|
2018-03-23 17:03:28 +00:00
|
|
|
- "{{ repos }}"
|
|
|
|
|
2019-04-24 15:37:36 +00:00
|
|
|
- name: Rename git repos on gerrit
|
2018-03-23 17:03:28 +00:00
|
|
|
shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git
|
|
|
|
with_nested:
|
2020-10-16 16:39:31 +00:00
|
|
|
- [ '~gerrit2/review_site/git/' ]
|
2018-03-23 17:03:28 +00:00
|
|
|
- "{{ repos }}"
|
|
|
|
|
2019-02-28 22:55:44 +00:00
|
|
|
- hosts: gitea
|
|
|
|
gather_facts: False
|
|
|
|
vars:
|
2019-04-24 15:37:36 +00:00
|
|
|
gitea_url: https://localhost:3000
|
2019-02-28 22:55:44 +00:00
|
|
|
tasks:
|
2019-05-31 16:07:26 +00:00
|
|
|
- include_vars: "{{ repolist }}"
|
2019-02-28 22:55:44 +00:00
|
|
|
- name: Move gitea repo
|
|
|
|
include_tasks: gitea-rename-tasks.yaml
|
|
|
|
loop: "{{ repos }}"
|
|
|
|
loop_control:
|
|
|
|
loop_var: repo
|
|
|
|
|
2019-04-24 15:37:36 +00:00
|
|
|
- hosts: storyboard-dev
|
|
|
|
gather_facts: False
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
|
|
|
|
- name: Rename projects in storyboard
|
|
|
|
shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql --defaults-file=/etc/mysql/debian.cnf storyboard
|
|
|
|
with_items: "{{ repos }}"
|
|
|
|
# We don't want to be blocked by errors on the dev server.
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- hosts: storyboard
|
2015-04-18 15:31:01 +00:00
|
|
|
gather_facts: False
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
2018-03-23 17:03:28 +00:00
|
|
|
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
|
|
|
|
- name: Rename projects in storyboard
|
2019-04-24 15:37:36 +00:00
|
|
|
shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql --defaults-file=/etc/mysql/debian.cnf storyboard
|
2018-03-23 17:03:28 +00:00
|
|
|
with_items: "{{ repos }}"
|
|
|
|
|
2022-01-24 21:07:14 +00:00
|
|
|
- hosts: zuul02.opendev.org
|
2019-05-29 18:18:07 +00:00
|
|
|
gather_facts: False
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
|
2021-08-09 21:33:31 +00:00
|
|
|
- name: Backup the zuul keys before we modify them
|
2022-06-10 07:14:34 +00:00
|
|
|
command: "docker exec zuul-scheduler_scheduler_1 zuul-admin export-keys /var/lib/zuul/zuul-keys-backup.json"
|
2019-05-29 18:18:07 +00:00
|
|
|
|
2021-08-09 21:33:31 +00:00
|
|
|
- name: Copy zuul keys from old to new project
|
2022-06-10 07:14:34 +00:00
|
|
|
command: "docker exec zuul-scheduler_scheduler_1 zuul-admin copy-keys gerrit {{ item.old }} gerrit {{ item.new }}"
|
2021-08-09 21:33:31 +00:00
|
|
|
loop: "{{ repos }}"
|
2019-05-29 18:18:07 +00:00
|
|
|
|
2018-05-02 21:24:42 +00:00
|
|
|
- hosts: review
|
2015-04-18 15:31:01 +00:00
|
|
|
gather_facts: False
|
2016-09-02 17:05:14 +00:00
|
|
|
remote_user: root
|
|
|
|
become: yes
|
|
|
|
become_user: gerrit2
|
2015-04-18 15:31:01 +00:00
|
|
|
tasks:
|
2018-03-23 17:03:28 +00:00
|
|
|
|
|
|
|
- name: Make backup of gerrit index
|
|
|
|
shell: cp -ax /home/gerrit2/review_site/index /home/gerrit2/index.backup.$(date +%s)
|
|
|
|
|
2024-03-06 17:19:29 +00:00
|
|
|
# As an alternative we can simply delete the waiting queue. Previously
|
|
|
|
# these were copied for debugging purposes but the problems are
|
|
|
|
# reasonably well understood so we probably don't need to keep collecting
|
|
|
|
# more data.
|
|
|
|
# We use the tmp/ path because it is not backed up and we don't need to
|
|
|
|
# preserve this information long term.
|
|
|
|
- name: Create replication queue target location
|
|
|
|
file:
|
|
|
|
path: /home/gerrit2/tmp/replication_waiting_queues
|
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
|
|
|
owner: gerrit2
|
|
|
|
group: gerrit2
|
|
|
|
- name: Move the replication plugin waiting queue aside due to bugs
|
|
|
|
shell: mv /home/gerrit2/review_site/data/replication/ref-updates/waiting /home/gerrit2/tmp/replication_waiting_queues/waiting_queue_$(date +%s)
|
|
|
|
|
2018-05-02 21:24:42 +00:00
|
|
|
- hosts: review
|
2015-04-18 15:31:01 +00:00
|
|
|
gather_facts: False
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
2018-03-23 17:03:28 +00:00
|
|
|
|
|
|
|
- name: Start gerrit
|
2020-03-20 12:26:42 +00:00
|
|
|
include_role:
|
|
|
|
name: gerrit
|
|
|
|
tasks_from: start
|
2020-03-20 14:18:36 +00:00
|
|
|
vars:
|
|
|
|
gerrit_run_init: false
|
2023-04-17 23:26:34 +00:00
|
|
|
gerrit_run_reindex: false
|
2020-03-20 14:18:36 +00:00
|
|
|
gerrit_run_compose_up: true
|
2018-03-23 17:03:28 +00:00
|
|
|
|
2018-05-02 21:24:42 +00:00
|
|
|
- hosts: review
|
2015-04-18 15:31:01 +00:00
|
|
|
gather_facts: False
|
2016-09-02 17:05:14 +00:00
|
|
|
remote_user: root
|
|
|
|
become: yes
|
|
|
|
become_user: gerrit2
|
2015-04-18 15:31:01 +00:00
|
|
|
tasks:
|
2018-03-23 17:03:28 +00:00
|
|
|
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
|
2021-07-23 20:14:28 +00:00
|
|
|
- name: Wait for gerrit ssh to be listening
|
|
|
|
wait_for:
|
|
|
|
host: localhost
|
|
|
|
port: 29418
|
|
|
|
# Far longer than necessary
|
|
|
|
timeout: 1800
|
|
|
|
|
|
|
|
- name: Sleep a bit longer just to be sure it is up
|
|
|
|
wait_for:
|
|
|
|
timeout: 30
|
2018-03-23 17:03:28 +00:00
|
|
|
|
|
|
|
- name: Set base ssh command fact
|
|
|
|
set_fact:
|
2021-07-23 20:14:28 +00:00
|
|
|
gerrit_ssh_command: ssh -p 29418 -i /home/gerrit2/review_site/etc/ssh_project_rsa_key openstack-project-creator@localhost gerrit
|
2018-03-23 17:03:28 +00:00
|
|
|
|
|
|
|
- name: Rename groups in gerrit
|
|
|
|
shell: "{{ gerrit_ssh_command }} rename-group {{ item.old }} {{ item.new }}"
|
|
|
|
with_items: "{{ gerrit_groups|default([]) }}"
|
|
|
|
|
2018-03-23 17:04:10 +00:00
|
|
|
- name: Start online reindex of accounts
|
|
|
|
shell: "{{ gerrit_ssh_command }} index start accounts --force"
|
|
|
|
|
2020-10-16 16:21:49 +00:00
|
|
|
- name: Start online reindex of groups
|
|
|
|
shell: "{{ gerrit_ssh_command }} index start groups --force"
|
|
|
|
|
|
|
|
- name: Start online reindex of projects
|
|
|
|
shell: "{{ gerrit_ssh_command }} index start projects --force"
|
|
|
|
|
2018-03-23 17:04:10 +00:00
|
|
|
- name: Start online reindex of changes
|
|
|
|
shell: "{{ gerrit_ssh_command }} index start changes --force"
|
2021-08-09 21:33:31 +00:00
|
|
|
|
2022-01-24 21:07:14 +00:00
|
|
|
- hosts: zuul02.opendev.org
|
2021-08-09 21:33:31 +00:00
|
|
|
gather_facts: False
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
|
|
|
- include_vars: "{{ repolist }}"
|
|
|
|
|
|
|
|
- name: Remove old zuul project keys
|
2022-06-10 07:14:34 +00:00
|
|
|
command: "docker exec zuul-scheduler_scheduler_1 zuul-admin delete-keys gerrit {{ item.old }}"
|
2021-08-09 21:33:31 +00:00
|
|
|
loop: "{{ repos }}"
|