Is this the *local* host listening on that port, or some remote system? If it's the local host, then you would want to use a fact that calls something like netstat or ss and returns a Boolean based on the result of that port selection. You could also return all listening ports as a Hash and go from there.
Generally, Puppet would be managing the service that actually listens on the port and you would simply include your manifest after starting that service. However, without knowing your setup, it's difficult to tell if you are in this situation. Thanks, Trevor On Mon, Sep 14, 2015 at 8:01 PM, aldantas <an...@mosin.com.br> wrote: > Hello, > > I am writing a puppet module and I am looking into a way to have a > validation before trying to execute something in puppet. > > For example: > > If host is listing on port 3306 { > > file { 'name': > ensure => file, > } > > } > > or > > If host is listing on port 3306 { > > include '::module::manifest' > > } > > > I am a little lost on how to accomplish this. I have tried creating a > custom function and custom factor but I wasn't successful. > > > Does anyone have any good solution for this? > > > Thanks!! > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/7776a753-d752-4a90-81a6-5cd71de6a3aa%40googlegroups.com > <https://groups.google.com/d/msgid/puppet-users/7776a753-d752-4a90-81a6-5cd71de6a3aa%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 -- This account not approved for unencrypted proprietary information -- -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CANs%2BFoU6%3DMsEYJqP9EE8D3TL-CWK1Ht6jjEJw8aqz%3Dj-h%3D8fYw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.