GithubHelp home page GithubHelp logo

nycrecords / ansible-role-rhsm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oasis-roles/rhsm

0.0 1.0 1.0 98 KB

Ansible role for Red Hat Subscription Manager support

License: GNU General Public License v3.0

Python 100.00%

ansible-role-rhsm's Introduction

Ansible Role: RHSM

GitHub Build Status Galaxy Ansible Ansible

This role will register or unregister a system using subscription-manager, and can also enable or disable repositories available via subscription.

Requirements

Ansible 2.4 or higher

Red Hat Enterprise Linux 7 or equivalent

Valid Red Hat Subscriptions

Role Variables

Currently the following variables are supported:

Subscription Management

Vars in this section directly correspond to the args available to the redhat_subscription module.

  • rhsm_username - access.redhat.com or Satellite (RHSM Provider) username
  • rhsm_password - access.redhat.com or Satellite (RHSM Provider) password
  • rhsm_org_id - RHSM Provider organization ID
  • rhsm_activationkey - RHSM Provider activation key
  • rhsm_server_hostname - hostname for alternate RHSM provider
  • rhsm_server_insecure - disable certificate verification when connecting to RHSM Provider (bool, default false)
  • rhsm_baseurl - Alternate base URL of package repositories if not using Red Hat CDN
  • rhsm_server_proxy_hostname - HTTP proxy hostname
  • rhsm_server_proxy_port - HTTP proxy port
  • rhsm_server_proxy_user - HTTP proxy username
  • rhsm_server_proxy_password - HTTP proxy password
  • rhsm_auto_attach - automatically consume from available subscriptions if registration succeeds (bool, default false, requires ansible >= 2.5)
  • rhsm_environment - Register with a specific environment in the destination org. (Used with Red Hat Satellite 6 or Katello)
  • rhsm_pool - Specific pool name to consume (regex can be used as input). Use rhsm_pool_ids when possible as it is much faster. Mutually exclusive with rhsm_pool_ids
  • rhsm_pool_ids - List of pool IDs to consume, or a list of dicts with pool IDs as keys and quantity of entitlements to consume as values. Mutually exclusive with rhsm_pool
  • rhsm_consumer_type - The type of unit to register (defaults to "system")
  • rhsm_consumer_name - Name of the system to register (defaults to system hostname)
  • rhsm_consumer_id - Existing consumer ID to resume a previous registration
  • rhsm_force_register - Register the system even if it is already registered (bool, default false)
  • rhsm_unregister - Unregister a system if true. The system will be unregistered. System registration will not be attempted (bool, default false)

Repository Management

Note:

Using variables related to repository management may result in the role reporting a failure if the system is not registered. Subscription tasks are run before repository management tasks to facilitate registration state before processing these variables.

  • rhsm_release - Set which operating system release version to use. Remember to quote this for release versions that look like floats to the YAML parser, e.g. set the value to something like "7.4", not 7.4. Values like 6Server and 7Server do not need to be quoted.
  • rhsm_release_unset - Unset which operating system release version to use (bool, default false)
  • rhsm_repositories - Specifies which repositories to enable/disable, details below

To enable/disable specific repositories:

rhsm_repositories:
  enabled:
    - enabled-repository
  disabled:
    - disabled-repository

The list of repositories in disabled is processed before enabled.

To enable only specific repositoryies and disable all others:

rhsm_repositories:
  only:
    - enabled-repository-1
    - enabled-repository-2

Using only is an idempotence-friendly version of the following:

rhsm_repositories:
  disabled:
    - "*"
  enabled:
    - enabled-repository-1
    - enabled-repository-2

Note that globbing in repository names is supported. Use of only is mutually exclusive with the use of enabled and disabled, and the use of only takes precedence.

To set a specific minor version of RHEL repositories to use:

rhsm_release: "7.1"

To default to the latest available minor version of repositories:

rhsm_release_unset: true

Role Output

DEPRECATION WARNING Role outputs are deprecated, no longer supported, and will be removed in a future version of this role.

oasis_role_rhsm

The oasis_role_rhsm fact will be set by this role, containing the following outputs:

  • subscribed - Whether or not the system is registered. (bool)
  • subscribed_pool_ids - A list of pool IDs current attached to the system. Will be an empty list if no pools are attached, or if the system is not currently registered.

Dependencies

Requires a system that supports the installation and usage of subscription-manager, e.g. Red Hat Enterprise Linux.

Privilege escalation (sudo) is required for this role to function.

Example Playbooks

This example registers a system with a username and password, auto-attaches, enables three RHEL 7 repositories, and explictly sets the repository release version of enabled repositories to "7Server".

- hosts: rhsm-servers
  roles:
    - role: rhsm
  vars:
    rhsm_username: your_username
    rhsm_password: your_password
    rhsm_auto_attach: true
    rhsm_repositories:
      only:
        - rhel-7-server-rpms
        - rhel-7-server-optional-rpms
        - rhel-7-server-extras-rpms
    rhsm_release: 7Server

This example registers a system to Red Hat Satellite 6 using an organization ID and activation key, and attaches to a specific pool by ID.

- hosts: rhsm-servers
  roles:
    - role: rhsm
  vars:
    rhsm_org_id: your_organization_id
    rhsm_activitionkey: activation_key
    rhsm_pool_ids:
      - poolid
    rhsm_server_hostname: your.satellite6.hostname

CA Certificates for Satellite 6 or Katello host should be installed first for HTTPS to work when being used as the RHSM Provider.

License

GPLv3

Author Information

Joel Castillo (@joelbcastillo) for the NYC Department of Records Dev Team (@nycrecords)

Forked from Sean Myers [email protected] (oasis-roles/rhsm)

ansible-role-rhsm's People

Contributors

greg-hellings avatar joelbcastillo avatar robled avatar

Watchers

 avatar

Forkers

smalshus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.