Closed robinvy closed 3 years ago
The at
module is now in the ansible.posix
collection:
https://github.com/ansible-collections/ansible.posix/blob/main/plugins/modules/at.py
It looks like AIX is closer to the POSIX standard than Linux:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/at.html
POSIX uses -r
to remove a job, not -d
.
I propose the following patch (Linux supports both -r
and -d
to remove a job):
79a80
> import platform
95c96
< at_command = "%s -d %s" % (at_cmd, matching_job)
---
> at_command = "%s -r %s" % (at_cmd, matching_job)
123c124,125
< at_command = "%s -c %s" % (at_cmd, split_current_job[0])
---
> at_opt = '-c' if platform.system() != 'AIX' else '-lv'
> at_command = "%s %s %s" % (at_cmd, at_opt, split_current_job[0])
PR has been merged upstream.
Removing a scheduled job does not work:
Linux uses "at -c job" to display the job content (including the script). AIX uses "at -lv job".
Linux uses "at -d job" to delete a job. AIX uses "at -r job". Notice that "atrm job" should work on both Linux and AIX.
After changing these two calls, at module works fine for both adding and removing jobs.
unique: yes
also works with this change (for the same reason).