Skip to content
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

use hostname from metadata #449

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/satellite-clone/library/parse_backup_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def parse_backup_metadata(params):
puppetserver_present = bool(find_rpm(rpms, "^puppetserver-[\d+].*"))
qpidd_present = bool(find_rpm(rpms, "^qpid-cpp-server-[\d+].*"))

hostname = data['hostname']

if not satellite_version:
satellite_version = os.getenv('SATELLITE_CLONE_FORCE_VERSION')

Expand All @@ -60,6 +62,7 @@ def parse_backup_metadata(params):
result = dict(satellite_version=satellite_version,
puppetserver_present=puppetserver_present,
qpidd_present=qpidd_present,
hostname=hostname,
msg=msg,
changed=False)
return True, result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
satellite_version: "{{ backup_metadata.satellite_version }}"
puppetserver_present: "{{ backup_metadata.puppetserver_present }}"
qpidd_present: "{{ backup_metadata.qpidd_present }}"
hostname: "{{ backup_metadata.hostname }}"
when:
- clone_metadata_exists
- backup_metadata is defined
Expand Down
15 changes: 2 additions & 13 deletions roles/satellite-clone/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,10 @@
paths:
- "vars"

- name: Identify the hostname from the backup config tar file
get_value_from_yaml_in_tarball:
tarball: "{{ config_files_path }}"
target_file: "etc/foreman-proxy/settings.yml"
keys: [":foreman_url"]
register: backup_hostname

- name: Set backup_hostname variable
set_fact:
hostname: "{{ backup_hostname.value | urlsplit('hostname') }}"

- name: Check that the hostname is not none
fail:
msg: "Unable to derive Satellite hostname from the backup config file - value ({{ hostname }}) doesn't look right"
when: backup_hostname|length == 0
msg: "Unable to derive Satellite hostname from the backup metadata file - value ({{ hostname }}) doesn't look right"
when: hostname|length == 0

- name: Check that the registration variables (activationkey, org) are updated
fail:
Expand Down
Loading