{"id":2215,"date":"2018-02-27T14:36:46","date_gmt":"2018-02-27T14:36:46","guid":{"rendered":"http:\/\/www.xn--slipsprogrammr-2qb.no\/?p=2215"},"modified":"2018-02-27T14:36:46","modified_gmt":"2018-02-27T14:36:46","slug":"automating-openldap-install-on-debianubuntu","status":"publish","type":"post","link":"https:\/\/www.slips.pl\/?p=2215","title":{"rendered":"Automating OpenLDAP install on Debian\/Ubuntu"},"content":{"rendered":"<p>If you install slapd from the commandline you&#8217;ll be prompted with a bunch of questions. If you install via some automation tool however, the story becomes a little different. There&#8217;s no prompt to input stuff the stuff setup needs, and you really don&#8217;t want to be prompted anyways. So&#8230; Let&#8217;s find all options available for this package.<\/p>\n<p><code>debconf-get-selections | grep slapd<\/code><\/p>\n<pre>\nslapd slapd\/password1 password\nslapd slapd\/internal\/generated_adminpw password\nslapd slapd\/password2 password\nslapd slapd\/internal\/adminpw password\n# Potentially unsafe slapd access control configuration\nslapd slapd\/unsafe_selfwrite_acl note\nslapd slapd\/dump_database_destdir string \/var\/backups\/slapd-VERSION\nslapd slapd\/move_old_database boolean true\nslapd slapd\/domain string\nslapd slapd\/invalid_config boolean true\nslapd slapd\/no_configuration boolean false\nslapd slapd\/password_mismatch note\t\n# Do you want the database to be removed when slapd is purged?\nslapd slapd\/purge_database boolean false\nslapd slapd\/allow_ldap_v2 boolean false\nslapd slapd\/backend select MDB\nslapd slapd\/dump_database select when needed\nslapd slapd\/upgrade_slapcat_failure error\nslapd shared\/organization string\n<\/pre>\n<p>All these &#8220;zany&#8221; options. Which ones are needed?<\/p>\n<p><code>DEBCONF_DEBUG=developer dpkg-reconfigure --frontend=noninteractive slapd 2&gt;\/tmp\/debug.log<\/code><\/p>\n<p><code>DEBCONF_DEBUG=developer<\/code> dumps debug code to stderr, which we cleverly dump to <code>\/tmp\/debug.log<\/code>. Scanning through that log we see<\/p>\n<pre>\ndebconf (developer): <-- INPUT medium slapd\/no_configuration\ndebconf (developer): --> 30 question skipped\ndebconf (developer): <-- INPUT medium slapd\/domain\ndebconf (developer): --> 30 question skipped\ndebconf (developer): <-- INPUT medium shared\/organization\ndebconf (developer): --> 30 question skipped\ndebconf (developer): <-- INPUT high slapd\/password1\ndebconf (developer): --> 30 question skipped\ndebconf (developer): <-- INPUT high slapd\/password2\ndebconf (developer): --> 30 question skipped\ndebconf (developer): <-- INPUT low slapd\/backend\ndebconf (developer): --> 30 question skipped\ndebconf (developer): <-- INPUT low slapd\/purge_database\ndebconf (developer): --> 30 question skipped\ndebconf (developer): <-- INPUT low slapd\/move_old_database\ndebconf (developer): --> 30 question skipped\ndebconf (developer): <-- INPUT medium slapd\/allow_ldap_v2\ndebconf (developer): --> 30 question skipped\n<\/pre>\n<p>Set these options before you install <code>slapd<\/code>.<\/p>\n<h2>Ansible example<\/h2>\n<pre>\n- name: set slapd install options\n  shell: \"echo \\\"{{ item }}\\\" | debconf-set-selections\"\n  with_items:\n    - slapd slapd\/no_configuration boolean false\n    - slapd slapd\/domain string slipsprogrammor.no\n    - slapd shared\/organization string Slips AS\n    - slapd slapd\/password1 password adminpass\n    - slapd slapd\/password2 password adminpass\n    - slapd slapd\/backend select MDB\n    - slapd slapd\/purge_database boolean false\n    - slapd slapd\/move_old_database boolean true\n    - slapd slapd\/allow_ldap_v2 boolean false\n\n- name: install packages\n  package:\n    name: \"{{ item }}\"\n  with_items:\n    - slapd\n    - ldap-utils\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you install slapd from the commandline you&#8217;ll be prompted with a bunch of questions. If you install via some automation tool however, the story becomes a little different. There&#8217;s no prompt to input stuff the stuff setup needs, and you really don&#8217;t want to be prompted anyways. So&#8230; Let&#8217;s find all options available for &hellip; <a href=\"https:\/\/www.slips.pl\/?p=2215\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Automating OpenLDAP install on Debian\/Ubuntu<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2215","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.slips.pl\/index.php?rest_route=\/wp\/v2\/posts\/2215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.slips.pl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.slips.pl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.slips.pl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.slips.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2215"}],"version-history":[{"count":0,"href":"https:\/\/www.slips.pl\/index.php?rest_route=\/wp\/v2\/posts\/2215\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.slips.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.slips.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.slips.pl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}