Add upgrade path from lsyncd to shared filesystem.
This patch checks if the repo server content directory is a mountpoint, and if it is not, creates an archive of the repo server contents before mounting the shared filesystem. After the mount completes, the archive of repo server contents is copied to the shared filesystem. This runs on every repo server in the deployment to include corner cases of repo servers running different OS versions or CPU architecures and will gather all of the content onto a single shared mount. Change-Id: I976a5ea5f6b6ebd65c22e89657763fef87cf4b23
This commit is contained in:
parent
c966363bd4
commit
1f39aa0239
@ -29,6 +29,46 @@
|
||||
createhome: "yes"
|
||||
home: "{{ repo_service_home_folder }}"
|
||||
|
||||
# NOTE(jrosser) remove this task in release after Z
|
||||
- name: Test if {{ repo_service_home_folder }}/repo exists
|
||||
stat:
|
||||
path: "{{ repo_service_home_folder }}/repo"
|
||||
register: _repo_folder_stat
|
||||
|
||||
# NOTE(jrosser) remove this task in release after Z
|
||||
- name: Test if {{ repo_service_home_folder }} is a mountpoint
|
||||
command: mountpoint -q {{ repo_service_home_folder }}/repo
|
||||
register: _repo_folder_mountpoint
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
when: _repo_folder_stat.stat.exists
|
||||
|
||||
# NOTE(jrosser) remove this task in release after Z
|
||||
- name: Ensure tar is present for repo server shared filesystem migration
|
||||
package:
|
||||
name:
|
||||
- tar
|
||||
state: present
|
||||
|
||||
# NOTE(jrosser) remove this task in release after Z
|
||||
- name: Archive existing content from repo server for migration from lsync to shared filesystem
|
||||
command:
|
||||
chdir: "{{ repo_service_home_folder }}"
|
||||
cmd: tar czf /opt/repo_server_lsync.tar.gz repo
|
||||
when:
|
||||
- _repo_folder_stat.stat.exists
|
||||
- _repo_folder_mountpoint.rc != 0
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
# NOTE(jrosser) remove this task in release after Z
|
||||
- file:
|
||||
path: "{{ repo_service_home_folder }}/repo"
|
||||
state: absent
|
||||
when:
|
||||
- _repo_folder_stat.stat.exists
|
||||
- _repo_folder_mountpoint.rc != 0
|
||||
|
||||
- name: Mount any remote volumes
|
||||
include_role:
|
||||
name: systemd_mount
|
||||
@ -36,6 +76,25 @@
|
||||
systemd_mounts: "{{ repo_server_systemd_mounts }}"
|
||||
when: repo_server_systemd_mounts | length > 0
|
||||
|
||||
# NOTE(jrosser) remove this task in release after Z
|
||||
- name: Restore repo content from archive into new shared filesystem
|
||||
unarchive:
|
||||
src: /opt/repo_server_lsync.tar.gz
|
||||
dest: "{{ repo_service_home_folder }}"
|
||||
remote_src: true
|
||||
exclude: ".ssh"
|
||||
when:
|
||||
- _repo_folder_stat.stat.exists
|
||||
- _repo_folder_mountpoint.rc != 0
|
||||
|
||||
# NOTE(jrosser) remove this task in release after Z
|
||||
- name: Fix permissions on restored repo content
|
||||
file:
|
||||
path: "{{ repo_service_home_folder }}"
|
||||
owner: "{{ repo_service_user_name }}"
|
||||
group: "{{ repo_service_group_name }}"
|
||||
recurse: yes
|
||||
|
||||
- name: File and directory setup (non-root user)
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user