How can I configure exim4 with a smarthost via puppet?

Solution 1:

Since the exim install doesn't come up with the config options, and just defaults to local mode, that may be why the options are getting set.

Anyway, one good option would be instead of using a dpkg-reconfigure, have puppet config the file /etc/exim4/update-exim4.conf.conf then run the command update-exim4.conf.

After you run the dpkg config once, the file will have the options set for you to reference for puppet's master copy, you'll probably want to use a template in puppet since there's hostnames in the file as well.

Solution 2:

You should be able to define the config type and smarthost in a local macro file. This would be /etc/exim4/conf.d/main/00_local_macros for a split configuration or /etc/exim4/exim4.conf.localmacros for the templated configuration.

The variables should be DC_eximconfig_configtype, DC_eximconfig_satellite, and DC_smarthost. See the section headed dynamically by /usr/sbin/update-exim4.conf in /var/lib/exim4/config.autogenerated.