-
Notifications
You must be signed in to change notification settings - Fork 152
[cifmw_cephadm] Support different ceph server and client versions #4012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,45 @@ | |
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| - name: Check if server/client version override is configured | ||
| ansible.builtin.set_fact: | ||
| _cifmw_cephadm_version_override: >- | ||
| {{ | ||
| (cifmw_cephadm_server_version | length > 0) and | ||
| (cifmw_cephadm_client_version | length > 0) and | ||
| (cifmw_cephadm_server_version != cifmw_cephadm_client_version) | ||
| }} | ||
|
|
||
| - name: Handle version override for cephadm installation | ||
| when: _cifmw_cephadm_version_override | bool | ||
| become: true | ||
| block: | ||
| - name: Parse version from cifmw_repo_setup_rhos_release_args | ||
| ansible.builtin.set_fact: | ||
| _cifmw_cephadm_default_version: "{{ cifmw_repo_setup_rhos_release_args | regex_search('ceph-([0-9.]+)') | regex_replace('^ceph-', '') }}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's say that I set
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree on this, we can check if 'ceph-([0-9.]+)' is there at L20. We stop early and we don't let the playbook running with unexpected results! |
||
|
|
||
| - name: Display version configuration | ||
| ansible.builtin.debug: | ||
| msg: | ||
| - "Default: {{ _cifmw_cephadm_default_version }}" | ||
| - "Server: {{ cifmw_cephadm_server_version }}" | ||
| - "Client: {{ cifmw_cephadm_client_version }}" | ||
| - "{{ 'WARNING: Client version differs from default rhos-release version' if (_cifmw_cephadm_default_version | trim) != (cifmw_cephadm_client_version | trim) else 'Client version matches default' }}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to print |
||
|
|
||
| - name: Disable default ceph repository | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if the
This way we have the same effect and we let the tool explicitly manage the repos.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does rhos-release -x really removes a single repository? And if rhos-release didn't do this, I think it should be handled there anyway. We should not manipulate its repositories directly.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No |
||
| when: cifmw_cephadm_server_version != _cifmw_cephadm_default_version | ||
| ansible.builtin.replace: | ||
| path: "/etc/yum.repos.d/rhos-release-ceph-{{ _cifmw_cephadm_default_version }}.repo" | ||
| regexp: '^enabled=1' | ||
| replace: 'enabled=0' | ||
|
|
||
| - name: Switch to server version repository | ||
| when: cifmw_cephadm_server_version != _cifmw_cephadm_default_version | ||
| ansible.builtin.command: | ||
| cmd: "rhos-release {{ cifmw_repo_setup_rhos_release_args | regex_replace('ceph-[0-9.]+', 'ceph-' + cifmw_cephadm_server_version) }}" | ||
| register: _cifmw_cephadm_server_repo | ||
| changed_when: "'Installed' in _cifmw_cephadm_server_repo.stdout" | ||
|
|
||
| - name: Enabled ceph Tools Repository | ||
| when: | ||
| - cifmw_cephadm_repository_override | bool | ||
|
|
@@ -35,6 +74,22 @@ | |
| delay: "{{ cifmw_cephadm_wait_install_delay }}" | ||
| until: task_result is success | ||
|
|
||
| - name: Disable server ceph repository before restore | ||
| when: _cifmw_cephadm_version_override | bool | ||
| become: true | ||
| ansible.builtin.replace: | ||
| path: "/etc/yum.repos.d/rhos-release-ceph-{{ cifmw_cephadm_server_version }}.repo" | ||
| regexp: '^enabled=1' | ||
| replace: 'enabled=0' | ||
|
|
||
| - name: Restore cifmw_repo_setup_rhos_release_args | ||
| when: _cifmw_cephadm_version_override | bool | ||
| become: true | ||
| ansible.builtin.command: | ||
| cmd: "rhos-release {{ cifmw_repo_setup_rhos_release_args }}" | ||
| register: _cifmw_cephadm_restore_repo | ||
| changed_when: "'Installed' in _cifmw_cephadm_restore_repo.stdout" | ||
|
|
||
| - name: Stat cephadm file | ||
| ansible.builtin.stat: | ||
| path: "{{ cifmw_cephadm_bin }}" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the new parameters are free form strings, should we guard against bad input, like: