theforeman.foreman.registration_command module – Manage Registration Command

Note

This module is part of the theforeman.foreman collection (version 5.1.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install theforeman.foreman. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: theforeman.foreman.registration_command.

New in theforeman.foreman 4.0.0

Synopsis

  • Manage Registration Command

Requirements

The below requirements are needed on the host that executes this module.

  • requests

Parameters

Parameter

Comments

activation_keys

list / elements=string

Activation keys for subscription-manager client, required for CentOS and Red Hat Enterprise Linux.

Required only if host group has no activation keys.

force

boolean

Clear any previous registration and run subscription-manager with --force.

Choices:

  • false

  • true

hostgroup

string

Host group to register the host in.

ignore_subman_errors

boolean

Ignore subscription-manager errors for subscription-manager register command.

Choices:

  • false

  • true

insecure

boolean

Enable insecure argument for the initial curl.

Choices:

  • false

  • true

jwt_expiration

integer

Expiration of the authorization token (in hours).

lifecycle_environment

string

Lifecycle environment for the host.

location

string

Location to register the host in.

operatingsystem

string

Operating System to register the host in.

Operating system must have a host_init_config template assigned.

organization

string

Organization to register the host in.

packages

string

Packages to install on the host when registered.

Multiple packages are to be given as a space delimited string.

password

string / required

Password of the user accessing the Foreman server.

If the value is not specified in the task, the value of environment variable FOREMAN_PASSWORD will be used instead.

remote_execution_interface

string

Identifier of the Host interface for Remote execution.

repo

string

Repository URL (yum/dnf) or full sources.list entry (apt).

repo_gpg_key_url

string

URL of the GPG key for the repository.

server_url

string / required

URL of the Foreman server.

If the value is not specified in the task, the value of environment variable FOREMAN_SERVER_URL will be used instead.

setup_insights

boolean

If this is set to true, insights-client will be installed and registered on Red Hat family operating systems.

Choices:

  • false

  • true

setup_remote_execution

boolean

If this is set to true, SSH keys will be installed on the host.

Choices:

  • false

  • true

setup_remote_execution_pull

boolean

If this is set to true, pull provider client will be deployed on the host.

Choices:

  • false

  • true

smart_proxy

string

Name of Smart Proxy.

This Proxy must have both the Templates and Registration features enabled.

update_packages

boolean

Update all packages on the host.

Choices:

  • false

  • true

username

string / required

Username accessing the Foreman server.

If the value is not specified in the task, the value of environment variable FOREMAN_USERNAME will be used instead.

validate_certs

boolean

Whether or not to verify the TLS certificates of the Foreman server.

If the value is not specified in the task, the value of environment variable FOREMAN_VALIDATE_CERTS will be used instead.

Choices:

  • false

  • true ← (default)

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying the entity

diff_mode

Support: full

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode

Examples

- name: "Generate registration command"
  theforeman.foreman.registration_command:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
  register: command

- name: "Perform registration"
  ansible.builtin.shell:
    cmd: "{{ command.registration_command }}"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

registration_command

string

The generated registration command.

Returned: success

Authors

  • Evgeni Golov (@evgeni)