Skip to content

Commit

Permalink
sync_plans role enhancements (#1478)
Browse files Browse the repository at this point in the history
* allow setting state of an sync plan in the role

document enabled and state params of sync_plans role
  • Loading branch information
evgeni authored Sep 23, 2022
1 parent d0e1ce6 commit ca1e725
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
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([]) }}"

0 comments on commit ca1e725

Please sign in to comment.