I'd construct a list var with the packages names and pass it to two tasks: 
first one would stop and disable the services and the second one would 
remove the packages.
Some packages are stopping the daemons as part of the uninstall/purge, some 
don't.

You could also do a 'dpkg-query -L <packagename>', save that in a list, do 
a 'apt-get remove --purge <packagename>' and then call the file module with 
state=absent and ignore_errors: True to ingest the previous list.

Not what you were expecting but it's simpler than stat'ing the init file :)

On Sunday, 21 December 2014 00:38:39 UTC+1, Kevin Burton wrote:
>
> I need the opposite of notify.
>
> Basically, I have a 'foo-off' role to turn services / daemons off for a 
> specific host.
>
> So if foo is the service, I want to stop foo , then apt-get remove it.
>
> - service: name=foo state=stopped
>
> ... because the second time it's run the daemon isn't present because the 
> package is removed.
>
> So what I need is kind of a notify that runs BEFORE a task.
>
> So something like
>
> - name: apt-get remove foo
>   apt: name=foo state=absent
>   before:
>     - stop foo
>
> ... is this possible? I guess I could stat the init script first but that 
> adds more complexity. 
>

-- 
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/4ff9ae8e-6e6e-4465-8757-45ec88c986ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to