Oefenweb / ansible-postfix

Ansible role to set up postfix in Debian-like systems
MIT License
174 stars 82 forks source link

transport_maps keeps records forever #138

Open markuman opened 5 months ago

markuman commented 5 months ago

https://github.com/Oefenweb/ansible-postfix/blob/7afaba08ddff0803e193c2b2c094624de418cb59/tasks/main.yml#L165-L182

The role is not handling the transport_maps exclusive. Means, once you set one transport map item, it will life forever, even if you remove the item from postfix_transport_maps in your playbook.

One possible fix would be

--- /tmp/before.yml     2024-05-21 10:21:01.294611164 +0200
+++ /tmp/after.yml      2024-05-21 10:21:19.108152033 +0200
@@ -7,7 +7,7 @@
     group: root
     mode: 0644
     create: true
-    state: present
+    state: "{{ item.state | default('present') }}"
   with_items: "{{ postfix_transport_maps }}"
   notify:
     - postmap transport_maps

That brings the possibility to drain single items from your postfix_transport_maps.

fliespl commented 1 month ago

Got me today with: postfix_sender_canonical_maps as well

tersmitten commented 1 month ago

Are you interested in creating a pull request?

tersmitten commented 1 month ago

The item.state seems ok