Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transport_maps keeps records forever #138

Open
markuman opened this issue May 21, 2024 · 3 comments
Open

transport_maps keeps records forever #138

markuman opened this issue May 21, 2024 · 3 comments

Comments

@markuman
Copy link

- name: configure transport maps
ansible.builtin.lineinfile:
dest: "{{ postfix_transport_maps_file }}"
regexp: '^{{ item.pattern | regex_escape }}\s.*'
line: '{{ item.pattern }} {{ item.result }}'
owner: root
group: root
mode: 0644
create: true
state: present
with_items: "{{ postfix_transport_maps }}"
notify:
- postmap transport_maps
- restart postfix
tags:
- configuration
- postfix
- postfix-transport-maps

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
Copy link

fliespl commented Sep 21, 2024

Got me today with: postfix_sender_canonical_maps as well

@tersmitten
Copy link
Member

Are you interested in creating a pull request?

@tersmitten
Copy link
Member

The item.state seems ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants