- name: Ensure initial gerrit state import_playbook: ../service-review.yaml vars: gerrit_container_image: docker.io/opendevorg/gerrit:3.4 - hosts: "review:!disabled" name: "Prepare Gerrit for Upgrade" tasks: - name: Pause for a few seconds to give gerrit time to start wait_for: timeout: 30 - name: Stop gerrit before we upgrade shell: cmd: docker-compose down chdir: /etc/gerrit-compose/ - name: Backup config files block: - name: Find .config files find: paths: /home/gerrit2/review_site/etc patterns: '*.config' register: _config_files - name: 'Backup config file' copy: src: '{{ item }}' dest: '{{ item }}.pre-upgrade' remote_src: true loop: "{{ _config_files.files | map(attribute='path') | list }}" - name: Perform gerrit upgrade import_playbook: ../service-review.yaml vars: gerrit_container_image: docker.io/opendevorg/gerrit:3.5 gerrit_run_init: true - hosts: "review:!disabled" name: "Post upgrade config check" tasks: - name: Diff config files shell: | diff -u {{ item }}.pre-upgrade {{ item }} | tee {{ item }}.diff loop: "{{ _config_files.files | map(attribute='path') | list }}" register: _diff_output - name: Check diffs fail: msg: 'Difference detected in file {{ item.item }} ' when: item.rc != 0 loop: '{{ _diff_output.results }}'