Hi everyone,
I'm looking into ansible for managing our farm of mail servers, and it looks very, very promising (as having used Puppet for another project, it is great to see the need for node setup greatly reduced :) )
So I'm looking into managing our postfix mailservers with ansible, and we have a lot of postmap type files, which have to be re-hashed on the remote side if a file changes.
I think handlers is the way to go here, but I'm not quite sure how to handle those in a play yet.
As an example, I am creating my relay_domains file from a template with the following task:
- name: Generate relay_domains
template: src=relay_domains.j2 dest={{ postfix }}/relay_domains
To get something executed now when the file changes, a notify would have to be used. But I really wouldn't like adding a static handler for each postmap file I'll be adding to the config, that is error prone and not really in the spirit of what I try to do here.
Ideally, the task would look something like this:
- name: Generate relay_domains
template: src=relay_domains.j2 dest={{ postfix }}/relay_domains
notify:
- postmap {{ postfix }}/relay_domains
With a handler defined something like this:
- name: postmap $i
action: postmap hash:$i
Is something like this possible? Or do I need to write a new map module based on the template module? (As most of the postmap files will probably be created from templates)
Or any other solution I could use?
Any help would be greatly appreciated, and thanks in advance!
Best regards,
Jens