Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add corresponding role for registration_commands module #1285

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions roles/registration_commands/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
theforeman.foreman.registration_command
===========================

Generate Registration Command

Role Variables
--------------

This role supports the [Common Role Variables](https://github.com/theforeman/foreman-ansible-modules/blob/develop/README.md#common-role-variables).

- `foreman_organization`: Organization to register the host in.
- `foreman_location`: Location to register the host in.
- `foreman_hostgroup`: Host group to register the host in.
- `foreman_operatingsystem`: Operating System to register the host in, operating system must have a `host_init_config` template assigned.
- `foreman_smart_proxy`: Register host through smart proxy.
- `foreman_insecure`: Enable insecure argument for the initial curl.
- `foreman_setup_remote_execution`: Set `host_registration_remote_execution` parameter for the host. If it is set to `true`, SSH keys will be installed on the host.
- `foreman_setup_insights`: Set `host_registration_insights` parameter for the host. If it is set to `true`, insights client will be installed and registered on Red Hat family operating systems.
- `foreman_packages`: Packages to install on the host when registered, example: `pkg1 pkg2`
- `foreman_update_packages`: Update all packages on the host.
- `foreman_repo`: Repository URL / details, for example for Debian OS family: 'deb http://deb.example.com/ buster 1.0', for Red Hat OS family: 'http://yum.theforeman.org/client/latest/el8/x86_64/'.
- `foreman_repo_gpg_key_url`: URL of the GPG key for the repository.
- `foreman_jwt_expiration`: Expiration of the authorization token (in hours).
- `foreman_remote_execution_interface`: Identifier of the Host interface for Remote execution.
- `foreman_activation_keys`: Activation keys for subscription-manager client, required for CentOS and Red Hat Enterprise Linux. Required only if host group has no activation keys.
- `foreman_lifecycle_environment`: Lifecycle environment for the host.
- `foreman_ignore_subman_errors`: Ignore subscription-manager errors for `subscription-manager register` command.
- `foreman_force`: Clear any previous registration and run subscription-manager with --force.

Example Playbooks
-----------------

Generate registration command

```yaml
- hosts: localhost
roles:
- role: theforeman.foreman.registration_commands
vars:
foreman_server_url: "https://foreman.example.com"
foreman_username: "admin"
foreman_password: "changeme"
foreman_organization: "Default Organization"
```
25 changes: 25 additions & 0 deletions roles/registration_commands/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- name: 'Generate registration command'
theforeman.foreman.registration_command:
username: "{{ foreman_username | default(omit) }}"
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization | default(omit) }}"
location: "{{ foreman_location | default(omit) }}"
hostgroup: "{{ foreman_hostgroup | default(omit) }}"
operatingsystem: "{{ foreman_operatingsystem | default(omit) }}"
smart_proxy: "{{ foreman_smart_proxy | default(omit) }}"
insecure: "{{ foreman_insecure | default(omit) }}"
setup_remote_execution: "{{ foreman_setup_remote_execution | default(omit) }}"
setup_insights: "{{ foreman_setup_insights | default(omit) }}"
packages: "{{ foreman_packages | default(omit) }}"
update_packages: "{{ foreman_update_packages | default(omit) }}"
repo: "{{ foreman_repo | default(omit) }}"
repo_gpg_key_url: "{{ foreman_repo_gpg_key_url | default(omit) }}"
jwt_expiration: "{{ foreman_jwt_expiration | default(omit) }}"
remote_execution_interface: "{{ foreman_remote_execution_interface | default(omit) }}"
activation_keys: "{{ foreman_activation_keys | default(omit) }}"
lifecycle_environment: "{{ foreman_lifecycle_environment | default(omit) }}"
ignore_subman_errors: "{{ foreman_ignore_subman_errors | default(omit) }}"
force: "{{ foreman_force | default(omit) }}"