theforeman.foreman.foreman_host (0.8.1) — module

Manage Foreman hosts

Authors: Bernhard Hopfenmueller (@Fobhep) ATIX AG

preview | supported by community

Install collection

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


Add to requirements.yml

  collections:
    - name: theforeman.foreman
      version: 0.8.1

Description

Manage Foreman host Entities

This beta version can create and delete hosts from preexisting host groups


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create a host"
  foreman_host:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "new_host"
    hostgroup: my_hostgroup
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create a host with build context"
  foreman_host:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "new_host"
    hostgroup: my_hostgroup
    build: true
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create an unmanaged host"
  foreman_host:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "new_host"
    managed: false
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Delete a host"
  foreman_host:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "new_host"
    state: absent

Inputs

    
ip:
    description:
    - IP address of the primary interface of the host.
    required: false
    type: str

mac:
    description:
    - MAC address of the primary interface of the host.
    - Please include leading zeros and separate nibbles by colons, otherwise the execution
      will not be idempotent.
    - Example EE:BB:01:02:03:04
    required: false
    type: str

name:
    description:
    - Fully Qualified Domain Name of host
    required: true
    type: str

build:
    description:
    - Whether or not to setup build context for the host
    required: false
    type: bool

image:
    description:
    - The image to use when I(provision_method=image).
    required: false
    type: str

owner:
    description:
    - Owner (user) of the host.
    - Mutually exclusive with I(owner_group).
    required: false
    type: str

realm:
    description: Realm name
    required: false
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the entity in Foreman
    type: str

domain:
    description: Domain name
    required: false
    type: str

medium:
    aliases:
    - media
    description:
    - Medium name
    - Mutually exclusive with I(kickstart_repository).
    required: false
    type: str

ptable:
    description: Partition table name
    required: false
    type: str

subnet:
    description: IPv4 Subnet name
    required: false
    type: str

comment:
    description:
    - Comment about the host.
    required: false
    type: str

enabled:
    description:
    - Include this host within Foreman reporting
    required: false
    type: bool

managed:
    description:
    - Whether a host is managed or unmanaged.
    - Forced to true when I(build=true)
    required: false
    type: bool

subnet6:
    description: IPv6 Subnet name
    required: false
    type: str

location:
    description:
    - Name of related location
    required: false
    type: str

password:
    description: Password of the user accessing the Foreman server
    required: true
    type: str

username:
    description: Username accessing the Foreman server
    required: true
    type: str

hostgroup:
    description:
    - Name of related hostgroup.
    required: false
    type: str

root_pass:
    description:
    - Root password.
    - Will result in the entity always being updated, as the current password cannot be
      retrieved.
    required: false
    type: str

parameters:
    description:
    - Entity domain specific host parameters
    elements: dict
    required: false
    suboptions:
      name:
        description:
        - Name of the parameter
        required: true
        type: str
      parameter_type:
        choices:
        - string
        - boolean
        - integer
        - real
        - array
        - hash
        - yaml
        - json
        default: string
        description:
        - Type of the parameter
        type: str
      value:
        description:
        - Value of the parameter
        required: true
        type: raw
    type: list

pxe_loader:
    choices:
    - PXELinux BIOS
    - PXELinux UEFI
    - Grub UEFI
    - Grub2 BIOS
    - Grub2 ELF
    - Grub2 UEFI
    - Grub2 UEFI SecureBoot
    - Grub2 UEFI HTTP
    - Grub2 UEFI HTTPS
    - Grub2 UEFI HTTPS SecureBoot
    - iPXE Embedded
    - iPXE UEFI HTTP
    - iPXE Chain BIOS
    - iPXE Chain UEFI
    description: PXE Bootloader
    required: false
    type: str

server_url:
    description: URL of the Foreman server
    required: true
    type: str

environment:
    description: Puppet environment name
    required: false
    type: str

owner_group:
    description:
    - Owner (user group) of the host.
    - Mutually excluside with I(owner).
    required: false
    type: str

architecture:
    description: Architecture name
    required: false
    type: str

content_view:
    description:
    - Katello Content view.
    - Only available for Katello installations.
    required: false
    type: str

organization:
    description:
    - Name of related organization
    required: false
    type: str

puppet_proxy:
    description: Puppet server proxy name
    required: false
    type: str

config_groups:
    description: Config groups list
    elements: str
    required: false
    type: list

puppetclasses:
    description: List of puppet classes to include in this host group. Must exist for
      hostgroup's puppet environment.
    elements: str
    required: false
    type: list

content_source:
    description:
    - Katello Content source.
    - Only available for Katello installations.
    required: false
    type: str

openscap_proxy:
    description:
    - OpenSCAP proxy name.
    - Only available when the OpenSCAP plugin is installed.
    required: false
    type: str

validate_certs:
    aliases:
    - verify_ssl
    default: true
    description: Whether or not to verify the TLS certificates of the Foreman server
    type: bool

compute_profile:
    description: Compute profile name
    required: false
    type: str

operatingsystem:
    description: Operatingsystem title
    required: false
    type: str

puppet_ca_proxy:
    description: Puppet CA proxy name
    required: false
    type: str

compute_resource:
    description: Compute resource name
    required: false
    type: str

provision_method:
    choices:
    - build
    - image
    - bootdisk
    description:
    - The method used to provision the host.
    - I(provision_method=bootdisk) is only available if the bootdisk plugin is installed.
    required: false
    type: str

kickstart_repository:
    description:
    - Kickstart repository name.
    - You need to provide this to use the "Synced Content" feature of Katello.
    - Mutually exclusive with I(medium).
    - Only available for Katello installations.
    required: false
    type: str

lifecycle_environment:
    description:
    - Katello Lifecycle environment.
    - Only available for Katello installations.
    required: false
    type: str