theforeman.foreman.smart_class_parameter (4.0.0) — module

Manage Smart Class Parameters

| "added in version" 1.0.0 of theforeman.foreman"

Authors: Baptiste Agasse (@bagasse)

Install collection

Install with ansible-galaxy collection install theforeman.foreman:==4.0.0


Add to requirements.yml

  collections:
    - name: theforeman.foreman
      version: 4.0.0

Description

Update Smart Class Parameters.

Smart Class Parameters are created/deleted for Puppet classes during import and cannot be created or deleted otherwise.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Update prometheus::server alertmanagers_config param default value"
  theforeman.foreman.smart_class_parameter:
    puppetclass_name: "prometheus::server"
    parameter: alertmanagers_config
    override: true
    required: true
    default_value: /etc/prometheus/alert.yml
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Update prometheus::server alertmanagers_config param default value"
  theforeman.foreman.smart_class_parameter:
    puppetclass_name: "prometheus::server"
    parameter: alertmanagers_config
    override: true
    override_value_order:
      - fqdn
      - hostgroup
      - domain
    required: true
    default_value: /etc/prometheus/alert.yml
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    override_values:
      - match: domain=example.com
        value: foo
      - match: domain=foo.example.com
        omit: true
    state: present

Inputs

    
omit:
    description:
    - Don't send this parameter in classification output.
    - Puppet will use the value defined in the Puppet manifest for this parameter.
    type: bool

state:
    choices:
    - present
    - present_with_defaults
    default: present
    description: State of the entity.
    type: str

override:
    description: Whether the smart class parameter value is managed by Foreman
    type: bool

password:
    description:
    - Password of the user accessing the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_PASSWORD)
      will be used instead.
    required: true
    type: str

required:
    description: If true, will raise an error if there is no default value and no matcher
      provide a value.
    type: bool

username:
    description:
    - Username accessing the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_USERNAME)
      will be used instead.
    required: true
    type: str

parameter:
    aliases:
    - smart_class_parameter
    description: Name of the parameter
    required: true
    type: str

server_url:
    description:
    - URL of the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_SERVER_URL)
      will be used instead.
    required: true
    type: str

description:
    description: Description of the Smart Class Parameter
    type: str

hidden_value:
    description: When enabled the parameter is hidden in the UI.
    type: bool

default_value:
    description: Value to use by default.
    type: raw

merge_default:
    description: Include default value when merging all matching values.
    type: bool

parameter_type:
    choices:
    - string
    - boolean
    - integer
    - real
    - array
    - hash
    - yaml
    - json
    - none
    description: Types of variable values. If C(none), set the parameter type to empty
      value.
    type: str

validate_certs:
    default: true
    description:
    - 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 C(FOREMAN_VALIDATE_CERTS)
      will be used instead.
    type: bool

validator_rule:
    description: Used to enforce certain values for the parameter values.
    type: str

validator_type:
    choices:
    - regexp
    - list
    description: Types of validation values.
    type: str

merge_overrides:
    description: Merge all matching values (only array/hash type).
    type: bool

override_values:
    description: Value overrides
    elements: dict
    required: false
    suboptions:
      match:
        description: Override match
        required: true
        type: str
      omit:
        description: Don't send this parameter in classification output, replaces use_puppet_default.
        type: bool
      value:
        description: Override value, required if omit is false
        type: raw
    type: list

avoid_duplicates:
    description: Remove duplicate values (only array type)
    type: bool

puppetclass_name:
    aliases:
    - puppetclass
    description: Name of the puppetclass that own the parameter
    required: true
    type: str

override_value_order:
    description: The order in which values are resolved.
    elements: str
    type: list

Outputs

entity:
  contains:
    smart_class_parameters:
      description: List of smart class parameters.
      elements: dict
      type: list
  description: Final state of the affected entities grouped by their type.
  returned: success
  type: dict