E.g. on Ubuntu Server:
- name: ensure non-needed and conflicting packages are removed
apt: pkg=$item state=absent purge=yes
This successfully removes sendmail, but sendmail daemon process remains in the memory and is still running, because the service is not stopped. If I add
service: name=sendmail state=stopped
before this task, it helps, but ONLY at the very first time (because next time "service" cannot find /etc/init.d/sendmail anymore - it was purged - and fails).
My proposal is one of:
Maybe this is an issue in sendmail deb package (it does not stop the daemon on removal), but I suppose there is a number of similar cases (e.g. apache2), so it could be a good ansible feature if implemented.
This is a package issue.
You should consider adding the service stopped with "ignore_errors: True"
..."lots of packages issue".
"ignore_errors: True" is not good here, because it adds a red line to the output (and possibly corrupts information during dry-run calls - I've not tested it yet). I think if a service is absent at all, it is OK to set its state as "stopped" with no errors...
It does not corrupt any information.
I disagree, it's important that service name typos be dealt with. If the package removal doesn't stop the service, this is a packaging info, and a workaround is going to be necessary.
iptables: option to configure Source NAT (#2292)
* Clean up trailing whitespace
* Add `--to-source` option to allow Source NAT (fix for #2291)