theforeman.foreman.hostgroup – Manage Hostgroups¶
Note
This plugin is part of the theforeman.foreman collection (version 2.0.1).
To install it use: ansible-galaxy collection install theforeman.foreman.
To use it in a playbook, specify: theforeman.foreman.hostgroup.
New in version 1.0.0: of theforeman.foreman
Parameters¶
Examples¶
- name: "Create a Hostgroup"
  theforeman.foreman.hostgroup:
    name: "new_hostgroup"
    architecture: "architecture_name"
    operatingsystem: "operatingsystem_name"
    medium: "media_name"
    ptable: "Partition_table_name"
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
- name: "Update a Hostgroup"
  theforeman.foreman.hostgroup:
    name: "new_hostgroup"
    architecture: "updated_architecture_name"
    operatingsystem: "updated_operatingsystem_name"
    organizations:
      - Org One
      - Org Two
    locations:
      - Loc One
      - Loc Two
      - Loc One/Nested loc
    medium: "updated_media_name"
    ptable: "updated_Partition_table_name"
    root_pass: "password"
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
- name: "My nested hostgroup"
  theforeman.foreman.hostgroup:
    parent: "new_hostgroup"
    name: "my nested hostgroup"
- name: "My hostgroup with some proxies"
  theforeman.foreman.hostgroup:
    name: "my hostgroup"
    environment: production
    puppet_proxy: puppet-proxy.example.com
    puppet_ca_proxy: puppet-proxy.example.com
    openscap_proxy: openscap-proxy.example.com
- name: "My katello related hostgroup"
  theforeman.foreman.hostgroup:
    organization: "My Org"
    name: "kt hostgroup"
    content_source: capsule.example.com
    lifecycle_environment: "Production"
    content_view: "My content view"
    parameters:
      - name: "kt_activation_keys"
        value: "my_prod_ak"
- name: "Delete a Hostgroup"
  theforeman.foreman.hostgroup:
    name: "new_hostgroup"
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: absent
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
| 
                
                entity
                
                 
                  dictionary
                                       
                                 | 
            success | 
                                         Final state of the affected entities grouped by their type. 
                                     | 
        |
| 
                
                hostgroups
                
                 
                  list
                   / elements=dictionary                     
                                 | 
            success | 
                                         List of hostgroups. 
                                     | 
        |
Authors¶
Manisha Singhal (@Manisha15) ATIX AG
Baptiste Agasse (@bagasse)