Chapter 8. Managing Red Hat subscriptions with cloud-init


You can use the rh_subscription directive to register your system. For each subscription, you need to edit user data.

Example 1

  • You can use the auto-attach and service-level options:

    Under rh_subscription, add your username and password, set auto-attach to True, and set service-level to self-support.

    rh_subscription:
      username: sample@redhat.com
      password: 'mypassword'
      auto-attach: True
      service-level: self-support
    Copy to Clipboard
    Note

    The service-level option requires that you use the auto-attach option.

Example 2

  • You can use the activation-key and org options:

    Under rh_subscription, add your activation key and org number and set auto-attach to True.

    rh_subscription:
      activation-key: example_key
      org: 12345
      auto-attach: True
    Copy to Clipboard

Example 3

  • You can add a subscription pool:

    Under rh_subscription, add your username, password, and pool number.

    rh_subscription:
      username: sample@redhat.com
      password: 'password'
      add-pool: XYZ01234567
    Copy to Clipboard
    Note

    This sample is the equivalent of the subscription-manager attach --pool=XYZ01234567 command.

Example 4

  • You can set a server host name in the /etc/rhsm/rhsm.conf file:

    Under rh_subscription, add your username, password, server-hostname, and set auto-attach to True.

    rh_subscription:
      username: sample@redhat.com
      password: 'password'
      server-hostname: test.example.com
      auto-attach: True
    Copy to Clipboard
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat