On 06.02.17 16:38 'Tom Bartsch' via Ansible Project wrote:
> My problem now is that if I call this playbook with "hosts=product"
> it will generate each of the group jobs 4 times. So it's 3 times to
> much.
Two ideas:
You can have more than one play in a playbook.
###############
- hosts: just_one_host
tasks:
- name: Add group job
...
- hosts: product
tasks:
- name: Add jobs per host
...
###############
Calling this via "ansible-playbook foobar.yml" executes first the task
on only one machine, creating the group job, and then runs the tasks
on all machines.
The other idea is to make your task see, if the group job has been
defined before. I do not know (and you did not tell) how you create
your jobs, but maybe you can check for existence of the jobs and only
create them, if necessary.
Johannes