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

[WIP] Closes #1653 Allow specifying the organization in content roles #1654

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
1 change: 1 addition & 0 deletions roles/activation_keys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The main data structure for this role is the list of `foreman_activation_keys`.

The following fields are required for an activation key but have defaults which make them optional for this role:

- `organization`: Organization to create the activation key for. Defaults to `foreman_organization` variable.
- `lifecycle_environment`: Lifecycle Environment to assign to hosts registered with this activation key. Defaults to "Library".
- `content_view`: Content View to assign to hosts registered with this activation key. Defaults to "Default Organization View".

Expand Down
2 changes: 1 addition & 1 deletion roles/activation_keys/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ item.organization | default(foreman_organization) }}"
name: "{{ item.name }}"
description: "{{ item.description | default(omit) }}"
lifecycle_environment: "{{ item.lifecycle_environment | default('Library') }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/content_view_publish/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ content_view.organization | default(foreman_organization) }}"
content_view: "{{ content_view.name | default(content_view.content_view) | default(content_view) }}"
description: "{{ content_view.description | default(omit) }}"
version: "{{ content_view.description | default(omit) }}"
Expand Down
4 changes: 4 additions & 0 deletions roles/content_views/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The main data structure for this role is the list of `foreman_content_views`. Ea

- `name` - the name of the content view

The following fields are required for a content view but have defaults which make them optional for this role:

- `organization`: Organization to create thw cxontent view for. Defaults to `foreman_organization` variable.

Each content view also requires either a list of repositories or components (for a composite content view):
- `repositories` - List of repositories to add to the content view. Each repository requires the following fields:
- `name` - The name of the repository
Expand Down
4 changes: 2 additions & 2 deletions roles/content_views/tasks/_create_content_view.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ content_view.organization | default(foreman_organization) }}"
name: "{{ content_view.name }}"
auto_publish: "{{ content_view.auto_publish | default(omit) }}"
components: "{{ content_view.components | default(omit) }}"
Expand All @@ -21,7 +21,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ content_view.organization | default(foreman_organization) }}"
name: "{{ item.name }}"
content_view: "{{ content_view.name }}"
repositories: "{{ item.repositories | default(omit) }}"
Expand Down
4 changes: 4 additions & 0 deletions roles/lifecycle_environments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ The main data structure for this role is the list of `foreman_lifecycle_environm
the environments are listed in the order the path would exist. It can't be
changed after the lifecycle environment has been created.

The following fields are required for a lifecycle environment but have defaults which make them optional for this role:

- `organization`: Organization to create thw lifecycle environment for. Defaults to `foreman_organization` variable.

The following fields are optional and will be omitted by default:

- `description`: Description of the lifecycle environment
Expand Down
2 changes: 1 addition & 1 deletion roles/lifecycle_environments/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ item.organization | default(foreman_organization) }}"
name: "{{ item.name }}"
description: "{{ item.description | default(omit) }}"
prior: "{{ item.prior }}"
Expand Down
1 change: 1 addition & 0 deletions roles/repositories/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This role supports the [Common Role Variables](https://github.com/theforeman/for
Each element of `repository_sets` must have a `name` and should specify the `basearch` and/or `releasever` only when multiple versions are available for that Product.
All repository sets for a Red Hat Product can be enabled by omitting `repository_sets` and instead specifying that the Product has `all_repositories: true`. When using this option it is also necessary to specify a list of repository `label`s for the Product (e.g. rhel-7-server-rpms). Be wary that this option can result in enabling a large number of unused repositories that, if added to sync plans, can greatly increase sync times and rapidly fill disk space.
Custom (i.e. non Red Hat) Products can also be defined, with associated `repositories` which represent custom repositories, and are required to have a `name`, `url`, and `content_type`; they may require additional fields and can take any parameter supported by [theforeman.foreman.repository](https://theforeman.github.io/foreman-ansible-modules/develop/plugins/repository_module.html).
The `organization` field can be specified for a product and repositories. The `origanization` field defaults to `foreman_organization` variable for a product and defaults to the `organization` field of the product for repositories.
A variety of examples are demonstrated in the data structure below:

```yaml
Expand Down
8 changes: 4 additions & 4 deletions roles/repositories/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ item.0.organization | default(foreman_organization) }}"
product: "{{ item.0.name }}"
name: "{{ item.1.name }}"
all_repositories: false
Expand All @@ -23,7 +23,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ item.0.organization | default(foreman_organization) }}"
label: "{{ item.1 }}"
all_repositories: true
state: enabled
Expand All @@ -37,7 +37,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ item.organization | default(foreman_organization) }}"
name: "{{ item.name }}"
label: "{{ item.label | default(omit) }}"
gpg_key: "{{ item.gpg_key | default(omit) }}"
Expand All @@ -51,7 +51,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ item.0.organization | default(foreman_organization) }}"
name: "{{ item.1.name }}"
url: "{{ item.1.url | default(omit) }}"
product: "{{ item.0.name }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/sync_plans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Role Variables

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

- `foreman_sync_plans`: List of sync plans to create. Each sync plan is represented as a dictionary which specifies the `name` of the sync plan and the `products` assigned to the sync plan. It also specifies the `interval` which can be 'hourly', 'daily', 'weekly', or 'custom cron'. In case the 'custom cron' `interval` is used, it should also specify the `cron_expression`. Finally the sync plan should have a `sync_date` which specifies the first time that the sync plan will run. Optionally the sync plan can be enabled and disabled using the `enabled` parameter, and its state can be managed using `state`.
- `foreman_sync_plans`: List of sync plans to create. Each sync plan is represented as a dictionary which specifies the `name` of the sync plan and the `products` assigned to the sync plan. It also specifies the `interval` which can be 'hourly', 'daily', 'weekly', or 'custom cron'. In case the 'custom cron' `interval` is used, it should also specify the `cron_expression`. Finally the sync plan should have a `sync_date` which specifies the first time that the sync plan will run. Optionally the sync plan can be enabled and disabled using the `enabled` parameter, and its state can be managed using `state`. The `organization` field can be specified for a sync plan and defaults to `foreman_organization` variable.

```yaml
foreman_sync_plans:
Expand Down
2 changes: 1 addition & 1 deletion roles/sync_plans/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
password: "{{ foreman_password | default(omit) }}"
server_url: "{{ foreman_server_url | default(omit) }}"
validate_certs: "{{ foreman_validate_certs | default(omit) }}"
organization: "{{ foreman_organization }}"
organization: "{{ item.organization | default(foreman_organization) }}"
name: "{{ item.name }}"
sync_date: "{{ item.sync_date }}"
interval: "{{ item.interval }}"
Expand Down
Loading