Can you have a handler notify another handler?

Otherwise, you could use a post-task in your playbook, I suppose.

On Wednesday, November 11, 2015 at 12:41:34 PM UTC-6, Dylan Martin wrote:
>
> Hi all, I have a strange one that I hope you can help me with.
>
> I'm trying to make a role for systemd service unit files.  This is the 
> newfangled replacement for good ol' sysV init scripts in Rhel7, any recent 
> Fedora and a lot of other linux distros.
>
> The workflow is supposed to go something like this.
>
> 1) edit/install a unit file, like /etc/systemd/system/myservice.service
> 2) run systemctl daemon-reload 
> 3) run systemctl enable myservice
> 4) run systemctl start myservice
>
> daemon-reload tells the systemd daemon to re-read the unit files so it 
> will know you changed something
>
> In ansible, I interpret that as looking like
>
> 1) template out unit file
> 2) notify daemon-reload handler if unit file changed
> 3) service enable=true state=started name=myservice
>
> The problem is, if I've changed the unit file, the daemon-reload runs 
> after the service enable/start, so systemd doesn't know to re-read the unit 
> file before trying to start/enable the service.
>
> I could just make it run daemon-reload every time the role runs, which 
> kindof sucks.  Also, if I'm installing a boatload of unit files, I'd like 
> to do a daemon-reload only once to get them all.  I could make the 
> daemon-reload a normal task that only runs when the template changes, but 
> that means I'd be running the daemon-reload once for every unit file, which 
> sucks in the case where I'm installing a boatload of them.  I looked at 
> post_task, but that's not for roles.  
>
> Does anyone know a good way to do this?
>
> Thanks!
> -Dylan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a91a236a-664c-43cf-b6c6-d0cb19e177c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to