An opinionated role using ansible modules redhat_subscription and rhsm_repository (new in Ansible 2.5) to allow for the easy registration of a host. Supports using either (activation key, organisation id) or (username, password) combinations.
In addition to registration, repositories can be disabled and/or enabled during execution of this role.
Note that this role has been developed for convenience in majority simple use case. And is not intended to be a catch-all role for subscription management.
No additional requirements are enforced other than an an Ansbile version greater than 2.5. Development was done on Ansible 2.5+.
This role supports the following configurations via variables.
redhat_subscription_org_id
: Subscription organisation ID. If using an activation key, this is required.redhat_subscription_activationkey
: Activation key to use for host registration.redhat_subscription_username
: If not using an activation key, specify Red Hat username.redhat_subscription_password
: If not using an activation key, specify Red Hat password. This is required if using credentials to register the host.redhat_subscription_state
: This variable can be used to specify if you want the subscription removed or added. This is passed directly to the state argument of the redhat_subscription module. Defaults topresent
.redhat_subscription_pool_regex
: Pool regex to use when registering the host. This is passed directly to the state argument of the redhat_subscription module. Defaults to^$
.redhat_subscription_auto_attach
: Supported only when using credentials to register. Defaults tono
.redhat_subscription_disable_repos
: Repositories to disable. Defaults to[]
.redhat_subscription_enable_repos
: Repositories to enable. Defaults to[]
.redhat_subscription_enable_explicit_repos_only
: This flag, if set, will explicitly disable all repositories that are not specified inredhat_subscription_enable_repos
.redhat_subscription_skip_prereq
: Skip all prerequisite checks.redhat_subscription_force
: Force registration. This is passed through to the underlying ansible module.redhat_subscription_retry
: Number of times to retry registering the host. Defaults to 0.
No Dependencies required other than Ansible itself.
Here is an example play that implements the Host Preparation steps associated with an OpenShift 3.9 cluster.
---
- name: prepare subscriptions for openshift node
hosts: all
become: yes
tasks:
- include_role:
name: devnullcake.redhat-subscription
vars:
redhat_subscription_org_id: 123456
redhat_subscription_activationkey: foobar-activation-key
redhat_subscription_pool_regex: "^.*OpenShift.*$"
redhat_subscription_enable_explicit_repos_only: "yes"
redhat_subscription_disable_repos: []
redhat_subscription_enable_repos:
- rhel-7-server-rpms
- rhel-7-server-extras-rpms
- rhel-7-server-ose-3.9-rpms
- rhel-7-fast-datapath-rpms
- rhel-7-server-ansible-2.4-rpms
There are no automated tests defined for this role at the moment. Molecule tests will be added at a later date. Current tox
execution validates source using ansible-lint.
This project has tox configured to run against a clean environment. This can simply be run using tox.
tox
Apache License 2.0