Description of problem: When scheduling repeated Ansible Role runs on either a single host or a host group, the initial run is scheduled after the start date specified when creating the job. Version-Release number of selected component (if applicable): Satellite 7.0.0, snap 7, running on both RHEL 7 and RHEL 8 How reproducible: 100% Steps to Reproduce: 1. Register a host to Satellite. 2. Import Ansible Roles to Satellite. 3. Assign an Ansible Role to the host. 4. Navigate to Hosts > All Hosts > [hostname], click the `New UI` button, then select the `Ansible` tab and the `Jobs` subtab. 5. Click the `Schedule recurring job` button. 6. Schedule an hourly job with a start time of 12:00 and a start date of tomorrow. 7. Note the start time of the next run by hovering the mouse pointer over the value in the `Next Run` column. 8. Cancel the scheduled job. 9. Repeat steps 6-8 with daily, weekly, and monthly repetition schedules. Actual results: - Hourly jobs have their first run scheduled for ten hours after the specified start time. - Daily jobs have their first run scheduled for 24 hours after the specified start time. - Weekly jobs have their first run scheduled for one week after the specified start time. - Monthly jobs have their first run scheduled for one month after the specified start time. This appears to be an increment of calendar months and not a specific number of days, i.e. a job scheduled to being on 11 February will have its first run scheduled for 11 March. Expected results: The start date and time of the first run match the values entered when the job is created. Additional info: - This behavior is identical when scheduling a repeated Ansible Roles run against a host group. - This behavior was tested with the `Default timezone` setting in the default state (empty). - Entering today's date as the start date for a repeated run displays the error message `Must not be in the past`, even in the specified start time is 12 hours after the current time. I am uncertain if I should create a separate BZ for this behavior or if it is related to the behavior reported above.
Created redmine issue https://projects.theforeman.org/issues/34691 from this bug
Hi, I've been successful in reproducing the issue on my local development setup (latest develop), sadly I still didn't find the way how to fix it, here are my observations so far: UC1: Foreman and the user both in "Europe/Prague (CEST, +0200)" zone * Set recurring job: 00:30, monthly, 30.04.2022 When you submit the form, parameters sent are `"scheduling"=>{"startAt"=>"2022-04-29T22:30:00.000Z"}` and job is planned correctly. UC2: Foreman and user in "America/Toronto (EDT, -0400)" zone * Set recurring job: 00:30, monthly, 30.04.2022 When you submit the form, parameters sent are `"scheduling"=>{"startAt"=>"2022-04-06T04:30:00.000Z"}` For some reason frontend code is changing the date to 06.04.2022, not sure why. I will continue in the investigation and share my progress when I'll have more information. Also want to note that this issue is not for recurring jobs in remote executions, it's just for Ansible plugin
I did some more testing and I was able to reproduce the issue with creating job invocation with recurring logic from the job invocation form, so I believe that the issue is in the foreman-tasks plugin rather than in the foreman-ansible. **Steps to reproduce the issue:** - Set your dev environment timezone to "EDT -0400", for example "America/Kentucky/Monticello (EDT, -0400)" - (user should get the time zone from the browser) - Create job with following parameters: Search Query: "name ~ *" command: "date" Schedule: "Set up recurring execution" Repeats: "monthly" Days: "30" At: "00:30" Starts at: "2022-04-30 00:30" The scheduled start date is "2022-05-30 00:30:00 -0400", one month later, which is wrong. If you set the time zone to "Europe/Prague (CEST, +0200)", the scheduled start date is correctly "2022-04-30 00:30:00 +0200". --- @aruzicka Could you please take a look? I may be wrong and the issue is somewhere else but this is all I've got so far.
Fixes will land in foreman-tasks and foreman_remote_execution. Leaving the component set to ansible as the new ansible workflow makes it rather easy to trigger the bug.
Fixes were merged in upstream, setting fixed-in-release, upstream releases will go out end of week-ish
Releases with fixes just went out.
Verified on Satellite 6.11, snap 18 running on both RHEL 7 and RHEL 8. Steps to Test: 1. Register a host to Satellite. 2. Import Ansible Roles to Satellite. 3. Assign an Ansible Role to the host. 4. Navigate to Hosts > All Hosts > [hostname], select the `Ansible` tab, then select the the `Jobs` subtab. 5. Click the `Schedule recurring job` button. 6. Schedule an hourly job with a start time of 12:00 and a start date of tomorrow. 7. Note the start time of the next run by hovering the mouse pointer over the value in the `Next Run` column. 8. Cancel the scheduled job. 9. Repeat steps 6-8 with daily, weekly, and monthly repetition schedules. Expected Results: The start date and time of the first run match the values entered when the job is created. Actual Results: The start date and time of the first run match the values entered when the job is created.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:5498