Debian Codegraph @

ansible_collections/theforeman/foreman/roles/sync_plans/README.md

raw symbols SCIP
1 theforeman.foreman.sync_plans
2 =============================
3
4 This role defines Sync Plans.
5
6 Role Variables
7 --------------
8
9 This role supports the [Common Role Variables](https://github.com/theforeman/foreman-ansible-modules/blob/develop/README.md#common-role-variables).
10
11 - `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.
12
13 ```yaml
14 foreman_sync_plans:
15 - name: Weekly Sync
16 interval: weekly
17 sync_date: 2020-11-07 00:00:00 UTC
18 products:
19 - Red Hat Enterprise Linux Server
20 - Red Hat Software Collections (for RHEL Server)
21 - Red Hat Enterprise Linux for x86_64
22 - CentOS 8
23 - Debian 10
24 - name: Monthly Foreman Client Sync
25 interval: custom cron
26 cron_expression: 0 6 8 * *
27 sync_date: 2020-11-08 00:06:00 UTC
28 products:
29 - Foreman Client
30 - name: Weeky Ubuntu Sync (disabled)
31 interval: weekly
32 sync_date: 2020-11-07 00:00:00 UTC
33 products:
34 - Ubuntu 22.04
35 enabled: false
36 ```
37
38 Example Playbooks
39 -----------------
40
41 Create two sync plans for two Organizations:
42
43 ```yaml
44 - hosts: localhost
45 roles:
46 - role: theforeman.foreman.sync_plans
47 vars:
48 foreman_server_url: https://foreman.example.com
49 foreman_username: "admin"
50 foreman_password: "changeme"
51 foreman_sync_plans:
52 - name: Weekly Sync
53 interval: weekly
54 sync_date: 2020-11-07 00:00:00 UTC
55 organization: RHEL
56 products:
57 - Red Hat Enterprise Linux Server
58 - Red Hat Enterprise Linux for x86_64
59 - name: Daily Sync
60 interval: daily
61 sync_date: 2020-11-08 00:00:00 UTC
62 organization: ACME
63 products:
64 - Red Hat Software Collections (for RHEL Server)
65 ```
66
67 Create a single sync plan which has all defined products (those defined in the `foreman_products` dictionary in ansible vars, for example as defined in the role documentation for [theforeman.foreman.repositories](https://github.com/theforeman/foreman-ansible-modules/tree/develop/roles/repositories#role-variables)) assigned to it:
68
69 ```yaml
70 - hosts: localhost
71 roles:
72 - role: theforeman.foreman.sync_plans
73 vars:
74 foreman_server_url: https://foreman.example.com
75 foreman_username: "admin"
76 foreman_password: "changeme"
77 foreman_organization: "Default Organization"
78 foreman_sync_plans:
79 - name: Weekly Sync
80 interval: weekly
81 sync_date: 2020-11-07 00:00:00 UTC
82 products: "{{ foreman_products | map(attribute='name') | list }}"
83 ```
84
85 The above example assumes that a yaml dictionary `foreman_products` is already defined in Ansible variables. It uses yaml methods to select the name of each product from that dictionary, convert them all to a list, and pass that list to the definition of the sync plan.