Blame README-hostgroup.md

Packit 8cb997
Hostgroup module
Packit 8cb997
================
Packit 8cb997
Packit 8cb997
Description
Packit 8cb997
-----------
Packit 8cb997
Packit 8cb997
The hostgroup module allows to ensure presence and absence of hostgroups and members of hostgroups.
Packit 8cb997
Packit 8cb997
The hostgroup module is as compatible as possible to the Ansible upstream `ipa_hostgroup` module, but additionally offers to make sure that hosts are present or absent in a hostgroup.
Packit 8cb997
Packit 8cb997
Packit 8cb997
Features
Packit 8cb997
--------
Packit 8cb997
* Hostgroup management
Packit 8cb997
Packit 8cb997
Packit 8cb997
Supported FreeIPA Versions
Packit 8cb997
--------------------------
Packit 8cb997
Packit 8cb997
FreeIPA versions 4.4.0 and up are supported by the ipahostgroup module.
Packit 8cb997
Packit 8cb997
Packit 8cb997
Requirements
Packit 8cb997
------------
Packit 8cb997
Packit 8cb997
**Controller**
Packit 8cb997
* Ansible version: 2.8+
Packit 8cb997
Packit 8cb997
**Node**
Packit 8cb997
* Supported FreeIPA version (see above)
Packit 8cb997
Packit 8cb997
Packit 8cb997
Usage
Packit 8cb997
=====
Packit 8cb997
Packit 8cb997
Example inventory file
Packit 8cb997
Packit 8cb997
```ini
Packit 8cb997
[ipaserver]
Packit 8cb997
ipaserver.test.local
Packit 8cb997
```
Packit 8cb997
Packit 8cb997
Packit 8cb997
Example playbook to make sure hostgroup databases exists:
Packit 8cb997
Packit 8cb997
```yaml
Packit 8cb997
---
Packit 8cb997
- name: Playbook to handle hostgroups
Packit 8cb997
  hosts: ipaserver
Packit 8cb997
  become: true
Packit 8cb997
Packit 8cb997
  tasks:
Packit 8cb997
  # Ensure host-group databases is present
Packit 8cb997
  - ipahostgroup:
Packit 8cb997
      ipaadmin_password: MyPassword123
Packit 8cb997
      name: databases
Packit 8cb997
      host:
Packit 8cb997
      - db.example.com
Packit 8cb997
      hostgroup:
Packit 8cb997
      - mysql-server
Packit 8cb997
      - oracle-server
Packit 8cb997
```
Packit 8cb997
Packit 8cb997
Example playbook to make sure that hosts and hostgroups are present in existing databases hostgroup:
Packit 8cb997
Packit 8cb997
```yaml
Packit 8cb997
---
Packit 8cb997
- name: Playbook to handle hostgroups
Packit 8cb997
  hosts: ipaserver
Packit 8cb997
  become: true
Packit 8cb997
Packit 8cb997
  tasks:
Packit 8cb997
  # Ensure hosts and hostgroups are present in existing databases hostgroup
Packit 8cb997
  - ipahostgroup:
Packit 8cb997
      ipaadmin_password: MyPassword123
Packit 8cb997
      name: databases
Packit 8cb997
      host:
Packit 8cb997
      - db.example.com
Packit 8cb997
      hostgroup:
Packit 8cb997
      - mysql-server
Packit 8cb997
      - oracle-server
Packit 8cb997
      action: member
Packit 8cb997
```
Packit 8cb997
`action` controls if a the hostgroup or member will be handled. To add or remove members, set `action` to `member`.
Packit 8cb997
Packit 8cb997
Example playbook to make sure hosts and hostgroups are absent in databases hostgroup:
Packit 8cb997
Packit 8cb997
```yaml
Packit 8cb997
---
Packit 8cb997
- name: Playbook to handle hostgroups
Packit 8cb997
  hosts: ipaserver
Packit 8cb997
  become: true
Packit 8cb997
Packit 8cb997
  tasks:
Packit 8cb997
  # Ensure hosts and hostgroups are absent in databases hostgroup
Packit 8cb997
  - ipahostgroup:
Packit 8cb997
      ipaadmin_password: MyPassword123
Packit 8cb997
      name: databases
Packit 8cb997
      host:
Packit 8cb997
      - db.example.com
Packit 8cb997
      hostgroup:
Packit 8cb997
      - mysql-server
Packit 8cb997
      - oracle-server
Packit 8cb997
      action: member
Packit 8cb997
      state: absent
Packit 8cb997
```
Packit 8cb997
Packit 8cb997
Example playbook to make sure host-group databases is absent:
Packit 8cb997
Packit 8cb997
```yaml
Packit 8cb997
---
Packit 8cb997
- name: Playbook to handle hostgroups
Packit 8cb997
  hosts: ipaserver
Packit 8cb997
  become: true
Packit 8cb997
Packit 8cb997
  tasks:
Packit 8cb997
  # Ensure host-group databases is absent
Packit 8cb997
  - ipahostgroup:
Packit 8cb997
      ipaadmin_password: MyPassword123
Packit 8cb997
      name: databases
Packit 8cb997
      state: absent
Packit 8cb997
```
Packit 8cb997
Packit 8cb997
Packit 8cb997
Variables
Packit 8cb997
=========
Packit 8cb997
Packit 8cb997
ipahostgroup
Packit 8cb997
-------
Packit 8cb997
Packit 8cb997
Variable | Description | Required
Packit 8cb997
-------- | ----------- | --------
Packit 8cb997
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
Packit 8cb997
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
Packit 8cb997
`name` \| `cn` | The list of hostgroup name strings. | no
Packit 8cb997
`description` | The hostgroup description string. | no
Packit 8cb997
`nomembers` | Suppress processing of membership attributes. (bool) | no
Packit 8cb997
`host` | List of host name strings assigned to this hostgroup. | no
Packit 8cb997
`hostgroup` | List of hostgroup name strings assigned to this hostgroup. | no
Packit 8cb997
`action` | Work on hostgroup or member level. It can be on of `member` or `hostgroup` and defaults to `hostgroup`. | no
Packit 8cb997
`state` | The state to ensure. It can be one of `present` or `absent`, default: `present`. | no
Packit 8cb997
Packit 8cb997
Packit 8cb997
Authors
Packit 8cb997
=======
Packit 8cb997
Packit 8cb997
Thomas Woerner