Created
June 25, 2026 18:27
-
-
Save sjha4/65e43e7ad8147b40d32ed02c7ba92710 to your computer and use it in GitHub Desktop.
Restore changes to support proxy flavor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [root@ip-10-0-168-10 backup]# cat /tmp/backup/foreman-proxy-restore.patch | |
| From: Claude Code | |
| Date: Thu, 25 Jun 2026 | |
| Subject: [PATCH] Fix restore for foreman-proxy installations | |
| Make foreman database restoration and deployment conditional based on | |
| installation flavor to support foreman-proxy systems that don't have | |
| the foreman database or full foreman services. | |
| Changes: | |
| 1. Make foreman database restoration conditional on 'foreman' feature | |
| 2. Use deploy-proxy.yaml for foreman-proxy installations | |
| 3. Update verification to check appropriate services per flavor | |
| --- | |
| src/playbooks/restore/restore.yaml | 39 ++++++++++++++++--- | |
| src/roles/restore/tasks/restore_databases.yaml | 1 + | |
| 2 files changed, 35 insertions(+), 5 deletions(-) | |
| diff --git a/src/roles/restore/tasks/restore_databases.yaml b/src/roles/restore/tasks/restore_databases.yaml | |
| index 14f8a92..a5c3e1f 100644 | |
| --- a/src/roles/restore/tasks/restore_databases.yaml | |
| +++ b/src/roles/restore/tasks/restore_databases.yaml | |
| @@ -37,6 +37,7 @@ | |
| - name: foreman | |
| dump_file: "{{ foreman_database_name }}.dump" | |
| database_name: "{{ foreman_database_name }}" | |
| owner: "{{ foreman_database_user }}" | |
| + when_feature: foreman | |
| - name: candlepin | |
| dump_file: "{{ candlepin_database_name }}.dump" | |
| database_name: "{{ candlepin_database_name }}" | |
| diff --git a/src/playbooks/restore/restore.yaml b/src/playbooks/restore/restore.yaml | |
| index 7c5f8a9..8d2e4c1 100644 | |
| --- a/src/playbooks/restore/restore.yaml | |
| +++ b/src/playbooks/restore/restore.yaml | |
| @@ -11,18 +11,47 @@ | |
| roles: | |
| - restore | |
| -- name: Deploy services after restore | |
| +- name: Deploy services after restore (foreman-proxy) | |
| + import_playbook: ../deploy-proxy/deploy-proxy.yaml | |
| + when: | |
| + - not validate | default(false) | |
| + - flavor is match('foreman-proxy.*') | |
| + | |
| +- name: Deploy services after restore (foreman) | |
| import_playbook: ../deploy/deploy.yaml | |
| - when: not validate | default(false) | |
| + when: | |
| + - not validate | default(false) | |
| + - not (flavor is match('foreman-proxy.*')) | |
| - name: Verify restore completion | |
| - hosts: quadlet | |
| + hosts: "{{ 'proxy' if flavor is match('foreman-proxy.*') else 'quadlet' }}" | |
| become: true | |
| gather_facts: false | |
| tasks: | |
| - name: Verify services after restore | |
| when: not validate | default(false) | |
| block: | |
| - name: Wait for services to stabilize | |
| ansible.builtin.pause: | |
| seconds: 30 | |
| - name: Check foreman.target status | |
| ansible.builtin.systemd: | |
| name: foreman.target | |
| register: restore_target_status | |
| failed_when: restore_target_status.status.ActiveState != 'active' | |
| + when: not (flavor is match('foreman-proxy.*')) | |
| - name: Wait for Foreman API to respond | |
| ansible.builtin.uri: | |
| url: "https://{{ ansible_fqdn }}/api/status" | |
| method: GET | |
| validate_certs: false | |
| status_code: [200, 401] | |
| register: restore_api_check | |
| until: restore_api_check.status in [200, 401] | |
| retries: 30 | |
| delay: 10 | |
| changed_when: false | |
| + when: not (flavor is match('foreman-proxy.*')) | |
| + | |
| + - name: Check foreman-proxy services | |
| + ansible.builtin.systemd: | |
| + name: "{{ item }}" | |
| + register: restore_proxy_status | |
| + failed_when: restore_proxy_status.status.ActiveState != 'active' | |
| + loop: | |
| + - foreman-proxy.service | |
| + - httpd.service | |
| + when: flavor is match('foreman-proxy.*') | |
| -- | |
| 2.45.2 |
sjha4
commented
Jul 17, 2026
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment