Delegating tasks from multiple hosts to one

31 views
Skip to first unread message

Paul Tötterman

unread,
Mar 23, 2016, 6:27:14 AM3/23/16
to Ansible Project
Hi,

I'm trying to delegate from multiple hosts to one in a play. Basically I'm trying to do something similar to puppet exported resources.

- hosts: slaves
  tasks
:
 
- cron:
      name
: '{{ansible_fqdn}}'
      job
: 'rsync {{ansible_fqdn}}:/srv/data /srv/backup/{{ansible_fqdn}}/srv/data/' # not really, but works for this example
      minute
: 0 # example only
      hour
: 0 # example only
    delegate_to
: master

However, after running this, only the cronjob for one slave host ends up on the master host. I also tried to write it as a loop using with_items, with the same results: only one cronjob.

I was also planning on creating monitoring configs on a monitoring host by delegating from hosts that should be monitored. This would be a very reusable pattern.

Any ideas how to solve this?

Cheers,
Paul
Reply all
Reply to author
Forward
0 new messages