2016-02-02 21:03:19 +00:00
|
|
|
# requires --extra-vars="target='host1:host2:group'"
|
2014-03-12 20:22:56 +00:00
|
|
|
# thanks threebean on this.
|
|
|
|
|
|
2024-11-25 18:24:56 +10:00
|
|
|
---
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Kills postfix which has been left around alive after update.
|
2014-03-12 20:22:56 +00:00
|
|
|
hosts: "{{ target }}"
|
|
|
|
|
user: root
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tasks:
|
2024-11-25 18:24:56 +10:00
|
|
|
- name: Try to stop postfix cleanly.
|
|
|
|
|
service: name=postfix state=stopped
|
2016-08-08 19:36:31 +00:00
|
|
|
|
2024-11-25 18:24:56 +10:00
|
|
|
# This doesn't really remove the pid file.. but we say it does so ansible only runs it if the pid file is there..
|
|
|
|
|
- name: Really kill postfix master process
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: pkill -u root master removes=/var/spool/postfix/pid/master.pid
|
2016-08-08 19:36:31 +00:00
|
|
|
|
2024-11-25 18:24:56 +10:00
|
|
|
- name: Clean up old pid lock file.
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: rm /var/spool/postfix/pid/master.pid removes=/var/spool/postfix/pid/master.pid
|
2016-08-08 19:36:31 +00:00
|
|
|
|
2024-11-25 18:24:56 +10:00
|
|
|
- name: Try to start postfix cleanly
|
|
|
|
|
service: name=postfix state=started
|