Re: [Puppet Users] puppet module - check if port is opened before running resource

2015-09-15 Thread Trevor Vaughan
In this case, you can have a fact that uses the code that you posted above. Facts are just Ruby so you can pretty much do whatever you need and return the boolean as the fact content. However, you may need to get a bit fancy and use a confine to ensure that only that one node is triggering the fac

Re: [Puppet Users] puppet module - check if port is opened before running resource

2015-09-15 Thread aldantas
No, it is remote. I am deploying a application cluster that has some nodes dependencies, so basically in order to execute a script in one node I need to make sure first that the remote node is already listening on a specific port, if that node is not listening on that port I do not want to execu

Re: [Puppet Users] puppet module - check if port is opened before running resource

2015-09-14 Thread Trevor Vaughan
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 fro

[Puppet Users] puppet module - check if port is opened before running resource

2015-09-14 Thread aldantas
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::