-
Notifications
You must be signed in to change notification settings - Fork 20
add quadlet recurring job runner and timers for core rake tasks #288
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
Merged
evgeni
merged 7 commits into
theforeman:master
from
archanaserver:recurring-quadlet-template
Dec 3, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
20e912b
add quadlet recurring job runner and timers for core rake tasks
archanaserver 0f506f5
simplify recurring rake timers, use instance-as-task, drop sysconfig
archanaserver 7829890
use explicit rake tasks per instance
archanaserver f446a34
drop symlink approach and generate real per-instance
archanaserver 812c042
updated the schedules to use daily/weekly/monthly
archanaserver 3868d82
align recurring timers with foreman.target and clean up units
archanaserver 711d4a2
add tests to verify recurring timer and service units
archanaserver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,6 +161,53 @@ | |
| - worker | ||
| - worker-hosts-queue | ||
|
|
||
| - name: Define templated Quadlet for recurring Foreman rake tasks | ||
| when: foreman_recurring_tasks_enabled | ||
| loop: "{{ foreman_recurring_tasks }}" | ||
| loop_control: | ||
| label: "{{ item.instance }}" | ||
| containers.podman.podman_container: | ||
| name: "foreman-recurring-{{ item.instance }}" | ||
| quadlet_filename: "foreman-recurring@{{ item.instance }}" | ||
| state: quadlet | ||
| image: "{{ foreman_container_image }}:{{ foreman_container_tag }}" | ||
| sdnotify: false | ||
| network: host | ||
| hostname: "{{ ansible_facts['fqdn'] }}" | ||
| command: "foreman-rake {{ item.rake }}" | ||
| volume: | ||
| - 'foreman-data-run:/var/run/foreman:z' | ||
| secrets: | ||
| - 'foreman-database-url,type=env,target=DATABASE_URL' | ||
| - 'foreman-seed-admin-user,type=env,target=SEED_ADMIN_USER' | ||
| - 'foreman-seed-admin-password,type=env,target=SEED_ADMIN_PASSWORD' | ||
| - 'foreman-settings-yaml,type=mount,target=/etc/foreman/settings.yaml' | ||
| - 'foreman-katello-yaml,type=mount,target=/etc/foreman/plugins/katello.yaml' | ||
| - 'foreman-ca-cert,type=mount,target=/etc/foreman/katello-default-ca.crt' | ||
| - 'foreman-client-cert,type=mount,target=/etc/foreman/client_cert.pem' | ||
| - 'foreman-client-key,type=mount,target=/etc/foreman/client_key.pem' | ||
| quadlet_options: | ||
| - | | ||
| [Unit] | ||
| PartOf=foreman.target | ||
| StartLimitIntervalSec=0 | ||
| - | | ||
| [Service] | ||
| TimeoutStartSec=30m | ||
| TimeoutStopSec=2m | ||
| KillMode=mixed | ||
| SyslogIdentifier=foreman-recurring-%i | ||
|
|
||
| - name: Render timers for recurring tasks | ||
| when: foreman_recurring_tasks_enabled | ||
| ansible.builtin.template: | ||
| src: [email protected] | ||
| dest: "/etc/systemd/system/foreman-recurring@{{ item.instance }}.timer" | ||
| mode: "0644" | ||
| loop: "{{ foreman_recurring_tasks }}" | ||
| loop_control: | ||
| label: "{{ item.instance }}" | ||
|
|
||
| - name: Run daemon reload to make Quadlet create the service files | ||
| ansible.builtin.systemd: | ||
| daemon_reload: true | ||
|
|
@@ -207,6 +254,16 @@ | |
| delay: 5 | ||
| register: foreman_status | ||
|
|
||
| - name: Enable & start recurring timers | ||
| when: foreman_recurring_tasks_enabled | ||
| ansible.builtin.systemd: | ||
| name: "foreman-recurring@{{ item.instance }}.timer" | ||
archanaserver marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| enabled: true | ||
| state: started | ||
| loop: "{{ foreman_recurring_tasks }}" | ||
| loop_control: | ||
| label: "{{ item.instance }}" | ||
|
|
||
| - name: Wait for Foreman tasks to be ready | ||
| ansible.builtin.uri: | ||
| url: '{{ foreman_url }}/api/v2/ping' | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [Unit] | ||
| Description=Timer for Foreman recurring: {{ item.rake }} | ||
| PartOf=foreman.target | ||
|
|
||
| [Timer] | ||
| Unit=foreman-recurring@{{ item.instance }}.service | ||
| OnCalendar={{ item.schedule }} | ||
| Persistent=true | ||
| RandomizedDelaySec=120 | ||
| AccuracySec=1min | ||
|
|
||
| [Install] | ||
| WantedBy=timers.target foreman.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.