Request for clarification on Provisioning Ubuntu Autoinstall

Problem:
Using Foreman :: Provisioning Ubuntu Autoinstall as a guide, we’re attempting to provision bare-metal laptops with autoinstall of Ubuntu Desktop 23.10. This article states the following: " The Preseed default finish template installs subscription-manager and registers the host to Foreman." When I look at the Preseed Default Finish template I do not see any call to the “subscription-manager-setup” snippet. This snippet’s description states that it is being called from the “global_registration” template. The Global Registration template, given its type, cannot be associated to an Operating System.

As it stands at the moment, subscription-manager does not get setup as part of our Ubuntu desktop provisioning process. Is Foreman (in our case, our proxy server) expected to automatically run the Global Registration template at some point of the process or should we simple add the subscription-manager-setup snippet to a cloned version of the Preseed Default Finish template?

Any clarification on this particular aspect would be greatly appreciated.

Expected outcome:
Subscription-manager gets installed as part of the provisioning process.

Foreman and Proxy versions:
Foreman and proxy are at 3.10

Foreman and Proxy plugin versions:

Distribution and version:
Almalinux 8.9

Other relevant data:
Our Foreman server is configured with the following features: Logs, Pulpcore, Puppet, Puppet CA

Our Proxy server is configured with the following features: Container_Gateway, Discovery, Dynflow, HTTPBoot, Logs, Pulpcore, Registration, Script, Templates, TFTP.

We also have a Windows proxy server configured with the following features: DHCP, DNS, Logs.

Due to our network configuration, our hosts cannot communicate with our foreman server, thus the provisioning is done via our proxy server.

1 Like

We did it via Ansible as Roles are always run after the successfull deployment and subscription-manager is not available from the default repositories. As it was a project to evaluate things we have not polished and published results yet, but here is the tasks list from what my colleague @cbreit created to solve it. Instead of the upstream URL we could already used the URL from Katello at registration stage.

---
# tasks file for foreman_register_host

- name: "Foreman Users"
  ansible.builtin.debug:
    var: foreman.foreman_users

- name: "Include GPG Key in Keyring"
  ansible.builtin.get_url:
    url: https://oss.atix.de/atix_gpg.pub
    dest: /etc/apt/keyrings/atix2.asc

- name: "Include Subscription-Manager Repository"
  ansible.builtin.apt_repository:
    repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/atix2.asc] https://oss.atix.de/Ubuntu22LTS/ stable main"
    update_cache: true

- name: "Generate registration command"
  theforeman.foreman.registration_command:
    username: "{{ foreman_username }}"
    password: "{{ foreman_password }}"
    server_url: "https://foreman.localdomain"
    validate_certs: false
    insecure: true
    force: true
    packages: "katello-host-tools-tracer"
    activation_keys: 
      - ubuntu-desktop
  register: command

- name: "Perform registration"
  ansible.builtin.shell:
    executable: /bin/bash
    cmd: "{{ command.registration_command }}"
  environment: 
    TERM: xterm

- name: "Add Symlink for Katello-Packet-Tracer"
  ansible.builtin.file:  
    src: /usr/sbin/katello-tracer-upload
    dest: /usr/bin/tracer-upload
    state: link

Thank you very much for your quick response and recommendation to use Ansible but I still would like confirmation whether the use of the available “subscription-manager-setup” snippet is a viable option.

Yes, as registration does also use the snippet (foreman/app/views/unattended/provisioning_templates/registration/global_registration.erb at develop · theforeman/foreman · GitHub). You just need to ensure subscription-manager is available at the state then I do not see any problem.