Ansible: Subscribe to Red Hat Network

Here’s a quick playbook to subscribe a host, or hosts to the Red Hat Network. Because I use subscription-manager commands so infrequently, I always have to look up usage in the man page first. Now I just run this playbook instead:

- name: Subscribe {{ ansible_hostname }} to Red Hat network 
  hosts: all
  # Requires ansible vault containing rhn username and password
  - name: Subscibe to RHN
      state: present
      username: "{{ rhn_user }}"
      password: "{{ rhn_password }}"
      auto_attach: true

Don’t forget to create an ansible vault containing rhn_user and rhn_password, and to run ansible-playbook with the –ask-vault-pass switch.

One thought on “Ansible: Subscribe to Red Hat Network

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.