Skip to content

Commit

Permalink
Use native cloud-init modules to register a host with subman
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Aug 19, 2024
1 parent 6ec00b9 commit 6b5b28f
Showing 1 changed file with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,36 @@ hostname: <%= @host.name %>
fqdn: <%= @host %>
manage_etc_hosts: true
users: {}
<% if host_param_true?('subscription_manager') || host_param('kt_activation_keys') -%>
<%
if host_param('kt_activation_keys')
subscription_manager_org = @host.rhsm_organization_label
activation_key = host_param('kt_activation_keys')
else
subscription_manager_org = host_param('subscription_manager_org')
activation_key = host_param('activation_key')
end
-%>
write_files:
- content: |
<%= indent(4) { foreman_server_ca_cert } %>
path: /etc/rhsm/ca/katello-server-ca.pem
ca_certs:
trusted:
-|
<%= indent(6) { foreman_server_ca_cert } %>
rh_subscription:
<% if activation_key -%>
activation-key: "<%= activation_key %>"
<% end -%>
org: "<%= subscription_manager_org %>"
<% if plugin_present?('katello') -%>
rhsm-baseurl: "<%= @pulp_content_url %>"
server-hostname: "<%= @rhsm_url&.host %>"
<% end -%>
# TODO: server-port and path from rhsm_url aren't supported
# TODO syspurpose
<% end -%>
runcmd:
- |
<%= indent(2) { snippet 'fix_hosts' } -%>
Expand All @@ -51,9 +81,6 @@ runcmd:
- |
<%= indent(2) { snippet 'epel' } -%>
<% end -%>
- |
<%= indent(2) { snippet 'redhat_register' } -%>
<% end -%>
<% if host_enc['parameters']['realm'] && @host.realm && (@host.realm.realm_type == 'FreeIPA' || @host.realm.realm_type == 'Red Hat Identity Management') -%>
- |
<%= indent(2) { snippet 'freeipa_register' } %>
Expand Down

0 comments on commit 6b5b28f

Please sign in to comment.