puppet-postfix icon indicating copy to clipboard operation
puppet-postfix copied to clipboard

Mynetworks value in init.pp is not applied

Open pier4r opened this issue 2 years ago • 2 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.26.0
  • Ruby: 2.7.0
  • Distribution: AlmaLinux release 8.8
  • Module version: 4.3.0

How to reproduce (e.g Puppet code you use)

Simply try to use in your manifest

class { 'postfix':
    mynetworks     => '127.0.0.1, 172.18.104.1, 172.17.0.1, 172.18.104.0/24',
}

What are you seeing

The mynetworks value is not set in /etc/postfix/main.cf

What behaviour did you expect instead

That the mynetworks value would be set in /etc/postfix/main.cf

I achieved the result via file_lineas follows:

file_line { 'postfix main.cf mynetworks since augeas in the postfix class does not work':
    ensure => 'present',
    path   => '/etc/postfix/main.cf',
    after  => '#mynetworks = hash:/etc/postfix/network_table',
    line   => "mynetworks = 127.0.0.1, 172.18.104.1, 172.17.0.1, 172.18.104.0/24",
}

Output log

Any additional information you'd like to impart

Maybe mynetworks shouldn't be set via init.pp, but then why is the attribute there? How can I set the networks?

pier4r avatar Oct 04 '23 15:10 pier4r

Did you enable either mta or satellite in class { 'postfix': ? One of these must be set to true (both are false by default) for any actual setup to take place.

olifre avatar Oct 04 '23 19:10 olifre

No I didn't, thank you (and sorry for the late answer).

In the meantime I found a workaround with configs => { mynetworks => { value => 'networks_here' }} but apparently is the lesser way.

pier4r avatar May 06 '24 14:05 pier4r