Automating SUSE Linux Registration & Module Management with Ansible

Share
Share

Manually registering and managing SUSE Linux subscriptions can be tedious. The Ansible SUSEConnect role simplifies this process by automating system registration, module activation, and de-registration. This guide explains how to use the role to automate system registration and module management with SUSEConnect.

Environment

SUSE Linux systems in this setup are deployed across various environments, from cloud instances to lightweight distributions like SUSE Linux Micro (SL-Micro).

The SUSEConnect Role

This role is designed to automate tasks such as:

  • Registering systems with SUSE Customer Center (SCC).
  • Activating or disabling additional modules and products.
  • Deregistering systems or subscriptions when no longer needed.
  • Ensuring compatibility with public cloud environments and transactional systems (SL-Micro).

Example: Registering a System

Here’s a simple example to register a SUSE Linux system and enable specific modules:


---
- name: Register SUSE system and enable modules
  hosts: all
  vars:
    suseconnect_base_product:
      key: "{{ sles_registration_key }}"   # Retrieved securely from Ansible Vault
      product: "{{ ansible_distribution }}"
    suseconnect_subscriptions:
      - { name: "sle-module-containers", state: enabled }
      - { name: "sle-module-python3", state: enabled }
  tasks:
    - name: Register system and activate modules
      ansible.builtin.include_role:
        name: suseconnect
Tip: Using Ansible Vault for SecurityFor security, sensitive information such as sles_registration_key should be stored securely using
Ansible Vault.

Deregistering a System

Use the following playbook to deregister a system:


---
- name: Deregister SUSE system
  hosts: all
  vars:
    suseconnect_deregister: true
  tasks:
    - name: Deregister system from SUSE Customer Center
      ansible.builtin.include_role:
        name: suseconnect

This playbook removes the system’s base subscription.

Adding or Removing Modules

You can enable or disable modules dynamically by specifying their state:


---
- name: Add or remove SUSE modules
  hosts: all
  vars:
    suseconnect_subscriptions:
      - {name: "sle-module-containers", state: enabled}
      - {name: "PackageHub", state: disabled}
  tasks:
    - name: Manage SUSE modules
      ansible.builtin.include_role:
        name: suseconnect

Conclusion

The Ansible SUSEConnect role makes system registration and subscription management simple and efficient. Whether managing a single server or multiple systems, this role saves time and minimizes errors by automating repetitive tasks.

Try it today to streamline SUSE Linux subscription management!

Explore the Role on GitHub

Share
(Visited 1 times, 1 visits today)
Avatar photo
107 views