[postfix] Migrate to lmdb #3120

Merged
zlopez merged 5 commits from zlopez/ansible:13035 into main 2026-03-11 13:27:23 +00:00
Owner

This change will migrate postfix from bdb to lmdb.
See infra/tickets#13035 for more
details.

Signed-off-by: Michal Konecny mkonecny@redhat.com

This change will migrate postfix from bdb to lmdb. See https://forge.fedoraproject.org/infra/tickets/issues/13035 for more details. Signed-off-by: Michal Konecny <mkonecny@redhat.com>
kevin left a comment
Owner

This is pretty invasive, so I think it will have to wait for after freeze?
Or do you want to try and land it before then?

For the rhel10 moving, we could just do a much smaller change to use lmdb for only rhel10 hosts?
Or just do it manually until after freeze.

This is pretty invasive, so I think it will have to wait for after freeze? Or do you want to try and land it before then? For the rhel10 moving, we could just do a much smaller change to use lmdb for only rhel10 hosts? Or just do it manually until after freeze.
@ -9,1 +9,4 @@
- name: Make sure postfix-lmdb is installed
ansible.builtin.package:
state: presend
Owner

Should be 'present' ?

Should be 'present' ?
Author
Owner

Oops, will fix

Oops, will fix
zlopez marked this conversation as resolved
@ -10,0 +10,4 @@
- name: Make sure postfix-lmdb is installed
ansible.builtin.package:
state: presend
name: postfix-lmdb
Owner

Sadly, there's no postfix-lmdb package in rhel/epel8... so we will need to exclude pagure from these changes.

Sadly, there's no postfix-lmdb package in rhel/epel8... so we will need to exclude pagure from these changes.
Author
Owner

Didn't checked that out, I'm also not sure if this will be needed on RHEL 10, maybe it will be part of postfix.

Didn't checked that out, I'm also not sure if this will be needed on RHEL 10, maybe it will be part of postfix.
Author
Owner

I added a when that will skip this for RHEL 8 and older.

I added a when that will skip this for RHEL 8 and older.
zlopez marked this conversation as resolved
@ -25,6 +33,57 @@
- base
- smtp_auth_relay
- name: Read the config file
Owner

I assume this section is just to migrate things in place, and can be removed after run?

Perhaps it would be better as just a stand alone playbook we run once after landing this?

I assume this section is just to migrate things in place, and can be removed after run? Perhaps it would be better as just a stand alone playbook we run once after landing this?
Author
Owner

Yeah, this should be run only once. I can prepare separate manual playbook for that. When I wrote it I wasn't sure what will be the best option, but separate manually run playbook makes sense.

Yeah, this should be run only once. I can prepare separate manual playbook for that. When I wrote it I wasn't sure what will be the best option, but separate manually run playbook makes sense.
zlopez marked this conversation as resolved
Author
Owner

@kevin wrote in #3120 (comment):

This is pretty invasive, so I think it will have to wait for after freeze? Or do you want to try and land it before then?

For the rhel10 moving, we could just do a much smaller change to use lmdb for only rhel10 hosts? Or just do it manually until after freeze.

I marked the PR as post-freeze as it's an invasive change. As this needs changes in main.cf file I wasn't sure how to specify it only for rhel10, as it's not really clear which template will be used.

@kevin wrote in https://forge.fedoraproject.org/infra/ansible/pulls/3120#issuecomment-537259: > This is pretty invasive, so I think it will have to wait for after freeze? Or do you want to try and land it before then? > > For the rhel10 moving, we could just do a much smaller change to use lmdb for only rhel10 hosts? Or just do it manually until after freeze. I marked the PR as post-freeze as it's an invasive change. As this needs changes in `main.cf` file I wasn't sure how to specify it only for rhel10, as it's not really clear which template will be used.
Author
Owner

So I'm thinking what is best approach here. I have few options in mind

  1. We change the main.cf files to use lmdb in role, we will need to have specific one for pagure or any other machine that doesn't support lmdb. We will move all the other changes to manual playbook, which will need to be run once for each machine.
    There is another problem with manual playbook that the first restart of postfix will fail as the *.lmdb file will not be in place. So it will be to execute postfix role, manual role and postfix role again, this will be needed during migration or when the machine will be installed again from scratch.
  2. We will do all the changes in manual playbook, which will also change all the btree/bhash entries in main.cf file to lmdb when executed, but that means every time the postfix playbook is executed, it will replace those changes
  3. Leave it as part of the postfix role as it is now, but skip the lmdb steps for machines that don't support it.

I think the third approach is best option. What do you think @kevin?

So I'm thinking what is best approach here. I have few options in mind 1) We change the `main.cf` files to use lmdb in role, we will need to have specific one for pagure or any other machine that doesn't support lmdb. We will move all the other changes to manual playbook, which will need to be run once for each machine. There is another problem with manual playbook that the first restart of postfix will fail as the `*.lmdb` file will not be in place. So it will be to execute postfix role, manual role and postfix role again, this will be needed during migration or when the machine will be installed again from scratch. 2) We will do all the changes in manual playbook, which will also change all the `btree/bhash` entries in `main.cf` file to `lmdb` when executed, but that means every time the postfix playbook is executed, it will replace those changes 3) Leave it as part of the postfix role as it is now, but skip the lmdb steps for machines that don't support it. I think the third approach is best option. What do you think @kevin?
Owner

I think 3 sounds fine, but also... instead of a manual playbook, how about we setup a handler and notify it when the postfix.cf changes to run the commands to generate the lmdb databases, but before we restart postfix?

Then it could all be in the playbook, but it's a lot simpler ?

I think 3 sounds fine, but also... instead of a manual playbook, how about we setup a handler and notify it when the postfix.cf changes to run the commands to generate the lmdb databases, but before we restart postfix? Then it could all be in the playbook, but it's a lot simpler ?
zlopez force-pushed 13035 from 94b8759b10 to c9fb38000f
Some checks failed
Linter / yamllint (pull_request) Successful in 43s
Linter / ansible-lint (pull_request) Failing after 47s
2026-02-25 11:28:10 +00:00
Compare
zlopez force-pushed 13035 from 103a51fcd7
Some checks failed
Linter / yamllint (pull_request) Failing after 25s
Linter / ansible-lint (pull_request) Failing after 49s
to 7fdfb301dc
Some checks failed
Linter / yamllint (pull_request) Successful in 25s
Linter / ansible-lint (pull_request) Failing after 51s
2026-02-25 12:02:08 +00:00
Compare
Author
Owner

@kevin wrote in #3120 (comment):

I think 3 sounds fine, but also... instead of a manual playbook, how about we setup a handler and notify it when the postfix.cf changes to run the commands to generate the lmdb databases, but before we restart postfix?

Then it could all be in the playbook, but it's a lot simpler ?

I think I addressed the RHEL8 machines and the handler approach in latest commit. Feel free to check it out.

@kevin wrote in https://forge.fedoraproject.org/infra/ansible/pulls/3120#issuecomment-544222: > I think 3 sounds fine, but also... instead of a manual playbook, how about we setup a handler and notify it when the postfix.cf changes to run the commands to generate the lmdb databases, but before we restart postfix? > > Then it could all be in the playbook, but it's a lot simpler ? I think I addressed the RHEL8 machines and the handler approach in latest commit. Feel free to check it out.
zlopez force-pushed 13035 from f7dd1203b7
Some checks failed
Linter / yamllint (pull_request) Successful in 26s
Linter / ansible-lint (pull_request) Failing after 49s
to 3ea4c13f57
Some checks failed
Linter / yamllint (pull_request) Successful in 27s
Linter / ansible-lint (pull_request) Failing after 47s
2026-02-25 12:13:51 +00:00
Compare
zlopez force-pushed 13035 from 3ea4c13f57
Some checks failed
Linter / yamllint (pull_request) Successful in 27s
Linter / ansible-lint (pull_request) Failing after 47s
to 251a7a1a17
Some checks failed
Linter / yamllint (pull_request) Successful in 24s
Linter / ansible-lint (pull_request) Failing after 46s
2026-02-25 12:17:11 +00:00
Compare
Author
Owner

I addressed the last ansible-lint error in #3172

I addressed the last ansible-lint error in https://forge.fedoraproject.org/infra/ansible/pulls/3172
kevin left a comment
Owner

I guess this handler will work. It seems pretty unelegant, but I cant think of a more clean way to do it.

I guess this handler will work. It seems pretty unelegant, but I cant think of a more clean way to do it.
@ -43,3 +43,4 @@ wsgi_procs: 4
wsgi_threads: 4
zabbix_macros:
'VFS.FS.FSTYPE.MATCHES': '^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs|nfs)$'
postfix_group:pkgs
Owner

missing space after : ?

missing space after : ?
Author
Owner

You are right, let me fix that.

You are right, let me fix that.
zlopez marked this conversation as resolved
@ -387,3 +387,3 @@
#
#alias_maps = dbm:/etc/aliases
alias_maps = hash:/etc/aliases
alias_maps = btree:/etc/aliases
Owner

why not just leave these as hash? shouldn't change until they go eol...

why not just leave these as hash? shouldn't change until they go eol...
Author
Owner

I didn't checked what was there before, will put it back to hash, no need to change it.

I didn't checked what was there before, will put it back to hash, no need to change it.
zlopez marked this conversation as resolved
Author
Owner

@kevin wrote in #3120 (comment):

I guess this handler will work. It seems pretty unelegant, but I cant think of a more clean way to do it.

I agree, it's not elegant, but I couldn't think of any better way as well. I still don't understand why there are different commands for conversion of /etc/aliases and everything else.

@kevin wrote in https://forge.fedoraproject.org/infra/ansible/pulls/3120#issuecomment-558311: > I guess this handler will work. It seems pretty unelegant, but I cant think of a more clean way to do it. I agree, it's not elegant, but I couldn't think of any better way as well. I still don't understand why there are different commands for conversion of `/etc/aliases` and everything else.
zlopez force-pushed 13035 from 251a7a1a17
Some checks failed
Linter / yamllint (pull_request) Successful in 24s
Linter / ansible-lint (pull_request) Failing after 46s
to cfef783390
Some checks failed
Linter / yamllint (pull_request) Successful in 27s
Linter / ansible-lint (pull_request) Failing after 49s
2026-02-26 09:12:28 +00:00
Compare
zlopez force-pushed 13035 from b356c2ed41
Some checks failed
Linter / yamllint (pull_request) Successful in 28s
Linter / ansible-lint (pull_request) Failing after 46s
to 5cb507cbcc
Some checks failed
Linter / yamllint (pull_request) Successful in 28s
Linter / ansible-lint (pull_request) Failing after 49s
2026-02-26 09:21:46 +00:00
Compare
zlopez force-pushed 13035 from 5cb507cbcc
Some checks failed
Linter / yamllint (pull_request) Successful in 28s
Linter / ansible-lint (pull_request) Failing after 49s
to ee60b1003b
Some checks failed
Linter / yamllint (pull_request) Successful in 25s
Linter / ansible-lint (pull_request) Failing after 46s
2026-03-02 09:10:44 +00:00
Compare
zlopez force-pushed 13035 from ee60b1003b
Some checks failed
Linter / yamllint (pull_request) Successful in 25s
Linter / ansible-lint (pull_request) Failing after 46s
to d4b957a92e
All checks were successful
Linter / yamllint (pull_request) Successful in 25s
Linter / ansible-lint (pull_request) Successful in 1m3s
2026-03-02 16:18:53 +00:00
Compare
Author
Owner

I fixed the ansible-lint errors in #3184

I fixed the ansible-lint errors in https://forge.fedoraproject.org/infra/ansible/pulls/3184
Author
Owner

Let me merge this and test it out on staging first.

Let me merge this and test it out on staging first.
zlopez merged commit f40260df77 into main 2026-03-11 13:27:23 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
infra/ansible!3120
No description provided.