Skip to content

Commit

Permalink
Fixes #35970 - add orcharhino branding to upgrading Smart Proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
maximiliankolb committed Feb 24, 2023
1 parent d90b26a commit 64e574f
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,54 @@ feature: ansible_run_capsule_upgrade
- name: satellite-maintain upgrade return code is non-zero
ansible.builtin.fail:
msg: "Failed! Capsule server upgrade failed. For more information, see /var/log/foreman-installer/capsule.log on your Capsule server."
<% elsif plugin_present?('orcharhino_core') -%>
tasks:
- name: Gather RPM package facts
ansible.builtin.package_facts:
manager: auto

- name: Fail if target server is orcharhino Server
ansible.builtin.fail:
msg: "This playbook cannot be executed on orcharhino Server. Use only on orcharhino Proxy."
when: "'orcharhino' in ansible_facts.packages"

- name: Install|Update foreman-maintain if not present
ansible.builtin.package:
name: rubygem-foreman_maintain
state: latest

- block:
<%- whitelist_option = if input('whitelist_options').present?
"--whitelist=#{input('whitelist_options')}"
end -%>
- name: Upgrade orcharhino Proxy using foreman-maintain
ansible.builtin.shell: foreman-maintain upgrade run --assumeyes --target-version={{ target_version }} <%= whitelist_option %>
register: result

- name: Re-Gather RPM package facts after the upgrade
ansible.builtin.package_facts:
manager: auto

- name: foreman-maintain upgrade return code is zero
ansible.builtin.debug:
msg: "Success! orcharhino Proxy upgrade completed. Current version of orcharhino Proxy is {{ ansible_facts.packages['orcharhino-proxy'][0]['version'] }}."

rescue:
- name: Print foreman-maintain output
ansible.builtin.debug:
var: result

- name: Grep top 10 Error messages from /var/log/foreman-installer/foreman-proxy-content.log
ansible.builtin.shell: grep '^\[ERROR' /var/log/foreman-installer/foreman-proxy-content.log | head -n 10
register: output_grep

- name: Print grepped Error messages
ansible.builtin.debug:
var: output_grep.stdout_lines

- name: foreman-maintain upgrade return code is non-zero
ansible.builtin.fail:
msg: "Failed! orcharhino Proxy upgrade failed. For more information, see /var/log/foreman-installer/foreman-proxy-content.log on your orcharhino Proxy."
<% else -%>
tasks:
- name: Gather RPM package facts
Expand Down

0 comments on commit 64e574f

Please sign in to comment.