Add names to rename playbook tasks
When running the playbook, it's not immediately clear which task is running without names. Add names. Also, update the whitespace to be more in-line with how we write playbooks for zuul. Change-Id: Ia189b8da6ded882aeb1fcff4932a1f9586027f80
This commit is contained in:
parent
956d953b9a
commit
11d70a1398
@ -1,54 +1,89 @@
|
||||
---
|
||||
- hosts: review.openstack.org
|
||||
gather_facts: False
|
||||
remote_user: root
|
||||
tasks:
|
||||
- shell: invoke-rc.d gerrit stop
|
||||
- include_vars: "{{ repolist }}"
|
||||
- shell: echo 'update account_project_watches set project_name = "{{ item.new }}" where project_name = "{{ item.old }}";' | mysql reviewdb
|
||||
with_items: "{{ repos }}"
|
||||
- shell: echo 'update changes set dest_project_name = "{{ item.new }}", created_on = created_on where dest_project_name = "{{ item.old }}";' | mysql reviewdb
|
||||
with_items: "{{ repos }}"
|
||||
- shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git
|
||||
with_nested:
|
||||
- [ '~gerrit2/review_site/git/', '/opt/lib/git/' ]
|
||||
- "{{ repos }}"
|
||||
|
||||
- include_vars: "{{ repolist }}"
|
||||
|
||||
- name: Stop Gerrit
|
||||
shell: invoke-rc.d gerrit stop
|
||||
|
||||
- name: Update account_project_watches in gerrit database
|
||||
shell: echo 'update account_project_watches set project_name = "{{ item.new }}" where project_name = "{{ item.old }}";' | mysql reviewdb
|
||||
with_items: "{{ repos }}"
|
||||
|
||||
- name: Update changes in gerrit database
|
||||
shell: echo 'update changes set dest_project_name = "{{ item.new }}", created_on = created_on where dest_project_name = "{{ item.old }}";' | mysql reviewdb
|
||||
with_items: "{{ repos }}"
|
||||
|
||||
- name: Rename git repos on gerrit
|
||||
shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git
|
||||
with_nested:
|
||||
- [ '~gerrit2/review_site/git/', '/opt/lib/git/' ]
|
||||
- "{{ repos }}"
|
||||
|
||||
- hosts: 'git0*'
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- include_vars: "{{ repolist }}"
|
||||
- shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git
|
||||
with_nested:
|
||||
- [ '/var/lib/git/' ]
|
||||
- "{{ repos }}"
|
||||
|
||||
- include_vars: "{{ repolist }}"
|
||||
|
||||
- name: Rename git repos on git farm
|
||||
shell: mv {{ item[0] }}{{ item[1].old }}.git {{ item[0] }}{{ item[1].new }}.git
|
||||
with_nested:
|
||||
- [ '/var/lib/git/' ]
|
||||
- "{{ repos }}"
|
||||
|
||||
- hosts: storyboard.openstack.org
|
||||
gather_facts: False
|
||||
remote_user: root
|
||||
tasks:
|
||||
- include_vars: "{{ repolist }}"
|
||||
- shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql --defaults-file=/root/.storyboard_db.cnf storyboard
|
||||
with_items: "{{ repos }}"
|
||||
|
||||
- include_vars: "{{ repolist }}"
|
||||
|
||||
- name: Rename projects in storyboard
|
||||
shell: echo 'update projects set name="{{ item.new }}" where name="{{ item.old }}";' | mysql --defaults-file=/root/.storyboard_db.cnf storyboard
|
||||
with_items: "{{ repos }}"
|
||||
|
||||
- hosts: review.openstack.org
|
||||
gather_facts: False
|
||||
remote_user: root
|
||||
become: yes
|
||||
become_user: gerrit2
|
||||
tasks:
|
||||
- shell: cp -ax /home/gerrit2/review_site/index /home/gerrit2/index.backup.$(date +%s)
|
||||
|
||||
- name: Make backup of gerrit index
|
||||
shell: cp -ax /home/gerrit2/review_site/index /home/gerrit2/index.backup.$(date +%s)
|
||||
|
||||
- hosts: review.openstack.org
|
||||
gather_facts: False
|
||||
remote_user: root
|
||||
tasks:
|
||||
- shell: invoke-rc.d gerrit start
|
||||
|
||||
# TODO: gerrit startup exceeds the timeout, so this task fails
|
||||
- name: Start gerrit
|
||||
shell: invoke-rc.d gerrit start
|
||||
|
||||
- hosts: review.openstack.org
|
||||
gather_facts: False
|
||||
remote_user: root
|
||||
become: yes
|
||||
become_user: gerrit2
|
||||
tasks:
|
||||
- pause: prompt="Make sure that Gerrit ssh api is accepting requests. Use Enter or ^C c to continue. ^C a to abort."
|
||||
- include_vars: "{{ repolist }}"
|
||||
- shell: ssh -p 29418 -i /home/gerrit2/review_site/etc/ssh_project_rsa_key openstack-project-creator@review.openstack.org gerrit rename-group {{ item.old }} {{ item.new }}
|
||||
with_items: "{{ gerrit_groups|default([]) }}"
|
||||
|
||||
- include_vars: "{{ repolist }}"
|
||||
|
||||
# TODO: Replace this with a wait_for?
|
||||
- pause:
|
||||
prompt: "Make sure that Gerrit ssh api is accepting requests. Use Enter or ^C c to continue. ^C a to abort."
|
||||
|
||||
- name: Set base ssh command fact
|
||||
set_fact:
|
||||
gerrit_ssh_command: ssh -p 29418 -i /home/gerrit2/review_site/etc/ssh_project_rsa_key openstack-project-creator@review.openstack.org gerrit
|
||||
|
||||
- name: Rename groups in gerrit
|
||||
shell: "{{ gerrit_ssh_command }} rename-group {{ item.old }} {{ item.new }}"
|
||||
with_items: "{{ gerrit_groups|default([]) }}"
|
||||
|
||||
# TODO: online reindex accounts
|
||||
# TODO: online reindex projects
|
||||
|
Loading…
Reference in New Issue
Block a user