lvps / 389ds-server

Ansible role to configure 389DS
Apache License 2.0
23 stars 14 forks source link

Installation additional ldif via dsconf doesn't seem to work #28

Closed Mr-Goldlog closed 2 years ago

Mr-Goldlog commented 2 years ago

Ansible returns an error: Error: -1 - Can't contact LDAP server - 2 - [] - No such file or directory

failed: [some_host] (item=~/some_ldif) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/usr/sbin/dsconf", "-D", "cn=admin", "
-w", "some_pass", "ldap://some_fqdn", "backend", "import", "userRoot", "/var/lib/dirsrv/slapd-host/ldif/some_ldif"], "delta":
"0:00:00.487725", "end": "some_time", "item": "~/some_ldif", "msg": "non-zero return code", "rc": 1, "start": "some_time", "stderr": "",
"stderr_lines": [], "stdout": "Error: -1 - Can't contact LDAP server - 2 - [] - No such file or directory", "stdout_lines": ["Error: -1 - Can't
contact LDAP server - 2 - [] - No such file or directory"]}

Most likely, the problem is that at the place where the task is running, the instance is not yet running. Of the possible solutions, you can place this task after the start of the service.

Or execute a command like:

dsconf {{dirsrv_serverid}} backend import {{dirsrv_bename}} /dir/file

Instead of: (how it is done now)

dsconf -D {{dirsrv_rootdn}} -w {{dirsrv_rootdn_password}} ldap://{{dirsrv_fqdn}} backend import userRoot /dir/file

This does not require ldap:// connection and imports the changes directly into the instance and does not require service start. Why isn't this used?

P.S. I can create a PR with one of these variants

lvps commented 2 years ago

I don't know why that other command wasn't used (I didn't code that part of the role), so for me it's ok to make the change. I'd really appreciate a PR indeed. Thanks

Mr-Goldlog commented 2 years ago

The testing took a bit longer)