Question: performing actions based on user account being present

36 views
Skip to first unread message

Matthew Reams

unread,
Feb 1, 2014, 12:13:48 AM2/1/14
to puppet...@googlegroups.com
I want to create a default module for SMTP.  However, I want to put some logic into it.

I have postfix as my default local SMTP server for my Linux servers.  However, I also have a Zimbra server.  Basically what I want to do is

If 'id zimbra' is true, then ensure service postfix is stopped.
Else ensure service postfix is running, and have the correct main.cf file.

Is that possible?

José Luis Ledesma

unread,
Feb 1, 2014, 4:06:37 AM2/1/14
to puppet...@googlegroups.com

I think there are two options.
1. Make use if hiera. If you don't have a lot of zimbra servers could be the best option, but you should maintain this manually.
2. A custom fact that reports if the server has zimbra or not.

Regards,

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e7252756-fb89-4c7c-9da6-2262c17e0b2c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

jcbollinger

unread,
Feb 3, 2014, 10:31:28 AM2/3/14
to puppet...@googlegroups.com


On Saturday, February 1, 2014 3:06:37 AM UTC-6, Jose Luis Ledesma wrote:

I think there are two options.
1. Make use if hiera. If you don't have a lot of zimbra servers could be the best option, but you should maintain this manually.
2. A custom fact that reports if the server has zimbra or not.


Indeed, there are two options.  One is to use a custom fact to report whether the target machine has Zimbra configured, as Jose suggests.  This is the way to go if Zimbra is outside the scope of what you want to manage via Puppet.

The other option is to teach the Puppet master whether the target node is supposed to have Zimbra.  If you are already managing the Zimbra configuration via Puppet then the master already has that information, at some level.  You need to make that information available at the point in your manifests where you declare the properties of the postfix service, and one way to do that -- by no means the only one -- would be to pull it up into an Hiera data store.

Either way, given information about whether the target node has or should have Zimbra, you can declare postfix appropriately.  For example,

service { 'postfix':
  enable => ! $zimbra_node,
  ensure => $zimbra_node ? { true => 'stopped', default => 'running' }
}


John

Matthew Reams

unread,
Feb 3, 2014, 5:19:38 PM2/3/14
to puppet...@googlegroups.com
Jose / John - Yeah, I didn't think it quite through.  After reading some of your suggestions, I think I'm going to try to do the following in my postfix manifest

service { 'postfix':
  enable => $postfix::enablestatus,
  ensure => $postfix::ensurestatus,
}

In Heira global.yaml, have those variables set to enabled and running.  In the Heira Zimbra server yaml, set those to disabled and stopped.

Thanks for the insight/suggestions!


--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/F30aOj3hKlg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/2c0fb7ad-b296-465f-9fbf-605342816770%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages