Problem: We are migrating from Puppet to Ansible. I have Ansible set up and assigned some roles to the first host. Remote exection is working and I can trigger an Ansible run manually by selecting “Run Ansible roles“ on the host page. Puppet is set up to run once every 30 minutes on all our hosts currently. We want to mimic this with Ansible. Is there a way to schedule a Ansible run for all hosts regularly.
Expected outcome: Ansible is run on each host at least twice per hour
Foreman and Proxy versions:
Foreman Version 3.18.1
Proxy Version 3.18.1
Foreman and Proxy plugin versions:
foreman-tasks 11.1.1
foreman_ansible 17.0.5
foreman_bootdisk 23.2.2
foreman_default_hostgroup 7.1.0
foreman_git_templates 2.0.0
foreman_puppet 9.1.0
foreman_remote_execution 16.5.3
foreman_templates 11.0.1
Distribution and version:
Alma Linux 9
Other relevant data:
I think you can achieve this using the default template “Ansible Roles - Ansible Default.” I don’t use it (yet), but the template seems to do exactly what you want: run all Ansible roles associated with the server.
If you then schedule the template (check out the Schedule → Recurring Execution section), you can have the template run on a recurring basis as often as you like.
Hi, that is exactly what I was expecting and looking for but I couldn’t find it. I now found it. I didn’t realize that I had to start the process from the host page and then, later in the process, could modify the target hosts. Thanks for the hint.
One Follow-up question. Is there a way to modify the recurring Job? For example if I want to change the frequency.
As far as I know, there’s only one way to do this:
- Go to Monitor → Jobs
- Enter “status = queued” in the search bar
- Search for and find your job
- Click on the job
- In the new window: Cancel the job
- Create a new job with the new frequency