Release 9.0.4 of NMIS 9 introduces a new feature of the installer for better non-interactive installations: answers to the installer's questions can now be preseeded before the installer is invoked.
This document describes briefly how the feature can be used to streamline NMIS 9 installations and upgrades.


When you use the existing non-interactive instalation mode (which is invoked by the -y  commandline argument), all questions and confirmations that the installer requests are answered  using the default choice. This  is sufficient for simple setups where the administrator is prepared to make adjustments post-installation, but doesn't provide sufficient flexibility for automating non-standard or more complex scenarios (e.g. an installation where different MongoDB users and passwords must be used).

Preseeding addresses this limitation: It allows you to prepare and save 'canned' answers to all installer questions, which the installer then applies automatically and non-interactively.

How Preseeding works

How to generate the preseed file

The installer itself is used to create the preseed information, which you will then want to edit with a text editor.

The argument -P  instructs the installer to look for preseedable questions in all its components and to save the preseed information in a new file; after that the installer terminates and no installation or upgrade is attempted.

Here is an example invocation which causes the preseed data to be saved in the file /tmp/preseed.txt:

$ ./ -- -P /tmp/preseed.txt
  100%    100%  checking file /tmp/selfgz25955/installer...
checking file /tmp/selfgz25955/admin/
checking file /tmp/selfgz25955/installer_hooks/01-pre-betaconfirm...
checking file /tmp/selfgz25955/installer_hooks/02-postcopy-dirs...
checking file /tmp/selfgz25955/installer_hooks/05-postcopy-configfiles...
checking file /tmp/selfgz25955/installer_hooks/05-pre-selinux...

Please note that the two hyphens before the -P  argument are absolutely required, as documented on the The Opmantek Installer page.

The preseed data produced by this operation for each question includes a comment describing what installer component poses the question (and on what line), followed by the question text itself and then the question id and the default answer (which is 'y' for yes-no questions, and an empty string for text questions).

The preseed file format

The format of a preseed file is very simple:

All preseedable questions are identified by a unique id tag, but you're naturally not expected to read the installer code to figure out which question has what id tag! The installer's preseed generation mode mentioned above takes care of all of this for you, and produces output like in this small example:

# line 106
# question "Should we try to start a local MongoDB daemon?"
993d	"y"

# line 157
# question "Enter your MongoDB ADMIN user for $dbserver:$port [default: $conf->{db_username}]:"
d92b	""

In the example above question 993d for setup_mongdb is primed in the affirmative, ie. setup-mongodb is allowed to start a local mongodb instance should that be required. The other question, d92b, informs setup-mongodb to use the default choice for the database admin user name (ie. the value from the default configuration file).

How to adjust a preseed file

Simply use a text editor on the preseed file (e.g. nano, vi, emacs) and change the answers you like to your preferred values.
For yes-no questions you can use 'y' and 'n'; for text question any text not containing double quotes is possible.

Here is some example non-default preseed data:

# installer line 202
# question "OK to use CPAN to install missing modules?"
9849	"n"

# 01-pre-betaconfirm line 22
# question "Your choice? "

Here question id 9849 is preseeded in the negative; i.e. the installer will not attempt to install missing perl modules using CPAN. The other question, id 8671 , confirms that the user acknowledges that NMIS 9 being still marked as beta.

It is likely that you'll need to run one or two installations in an interactive fashion to determine the  relevance of the individual questions. The preseed generation mode simply lists all existing questions for adjustment, but  in practice you won't encounter some of them or only rarely.

In certain special cases you may also want to look at the actual installer and installer components' source for further enlightenment. Simply running ./ --keep --noexec  will  unpack and not  invoke the installer; he files installer  and installer_hooks/*  in the resulting directory contain all of the relevant logic in perl or shell form.

How to run  the installer with a preseed file

To invoke the installer in non-interactive mode with preseeded answers, simply use the -p  argument followed by the path to the preseed file you generated earlier; e.g.

$ ./ -- -p /tmp/preseed.txt
Uncompressing NMIS Version 9.0.4  100%  
Ok to proceed with installation? (preseeded answer "y" interpreted as "YES")

Again please note that the two hyphens before the -p argument are required.

When invoked with -p  and a parseable preseed file, the installer will  automatically answer all questions without any user interaction:

Both the  console output and the installation log (in /usr/local/nmis9/install.log)  point out all preseeded and automatically answered questions as such.

Limitations and Caveats