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).

Installing the Role

The SUSEConnect role is part of the Ansible Linux System Roles collection. To install it, follow the instructions in the Introduction to Ansible Linux System Roles on SLES 16 guide.

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
  become: true
  tasks:
    - name: Register system and activate modules
      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 }
      ansible.builtin.include_role:
        name: suse.linux_system_roles.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
  become: true
  tasks:
    - name: Deregister system from SUSE Customer Center
      vars:
        suseconnect_deregister: true
      ansible.builtin.include_role:
        name: suse.linux_system_roles.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
  become: true
  tasks:
    - name: Manage SUSE modules
      vars:
        suseconnect_subscriptions:
          - {name: "sle-module-containers", state: enabled}
          - {name: "PackageHub", state: disabled}
      ansible.builtin.include_role:
        name: suse.linux_system_roles.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!

For more information about the SUSEConnect role and other Ansible Linux System Roles, see the Introduction to Ansible Linux System Roles on SLES 16 guide.

Share
(Visited 28 times, 3 visits today)
Avatar photo
1,868 views