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

Added host collections role #1814

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
42 changes: 42 additions & 0 deletions roles/host_collections/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
theforeman.foreman.foreman_host_collections
=============================

This role creates and manages Host Collections.

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

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

- `foreman_host_collections`: List of host collections to manage that are each represented as a dictionary. See module documentation for a list of available options for each host collection.
Host collections may have any set of fields defined on them.
A variety of examples are demonstrated in the data structure below:

```yaml
foreman_host_collections:
- name: "Apache hosts"
description: "All Apache Servers"
organization: "Some Org"
- name: "Foremans"
description: "Foreman Servers"
organization: "Handymen org"
```

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

This example creates several host collections.

```yaml
- hosts: localhost
roles:
- role: theforeman.foreman.host_collections
vars:
foreman_server_url: https://foreman.example.com
foreman_username: "admin"
foreman_password: "changeme"
foreman_host_collections:
- name: "Apache hosts"
description: "All Apache Servers"
organization: "Some Org"
```
4 changes: 4 additions & 0 deletions roles/host_collections/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
galaxy_info:
description: Create and manage Host Collections
standalone: false
14 changes: 14 additions & 0 deletions roles/host_collections/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: 'Create Host Collections' # noqa: args[module]
theforeman.foreman.host_collection:
username: "{{ foreman_username | default(omit) }}"
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
name: "{{ item.name }}"
updated_name: "{{ item.updated_name | default(omit) }}"
description: "{{ item.description | default(omit) }}"
organization: "{{ item.organization | default(omit) }}"
state: "{{ item.state | default(omit) }}"

Check failure on line 12 in roles/host_collections/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint

yaml[trailing-spaces]

Trailing spaces
with_items:
- "{{ foreman_host_collections }}"
Loading