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

sync_plans role enhancements #1478

Merged
merged 3 commits into from
Sep 23, 2022
Merged
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
3 changes: 3 additions & 0 deletions changelogs/fragments/1477-sync_plans-enhancements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- sync_plans role - expose the ``state`` parameter of the underlying module, thus allowing to delete plans (https://github.com/theforeman/foreman-ansible-modules/issues/1477)
- sync_plans role - document the ``enabled`` parameter (https://github.com/theforeman/foreman-ansible-modules/issues/1477)
8 changes: 7 additions & 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.
- `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`.

```yaml
foreman_sync_plans:
Expand All @@ -27,6 +27,12 @@ foreman_sync_plans:
sync_date: 2020-11-08 00:06:00 UTC
products:
- Foreman Client
- name: Weeky Ubuntu Sync (disabled)
interval: weekly
sync_date: 2020-11-07 00:00:00 UTC
products:
- Ubuntu 22.04
enabled: false
```
Example Playbooks
Expand Down
1 change: 1 addition & 0 deletions roles/sync_plans/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
cron_expression: "{{ item.cron_expression | default(omit) }}"
enabled: "{{ item.enabled | default(true) }}"
products: "{{ item.products }}"
state: "{{ item.state | default(omit) }}"
with_items: "{{ foreman_sync_plans | default([]) }}"