How use internet connection check as requirement for puppet agent run?

asked 2016-03-09 01:59:17 -0600

thilko gravatar image

I would like to configure some linux clients inside a windows network. On each client a cntlm proxy needs to be configured with custom user credentials. As long as the internet connection isn´t setup, no puppet ressources could be applied.

I am looking for an easy way to have some kind of check if the internet connection is there. My first thoughts:

  • a custom fact
  • a exec resource

Would it be possible to have something like:

if($has_internet_connection){
     # some resources here
}
edit retag flag offensive close merge delete

Comments

I would think a custom fact is probably your easiest bet, but I have also seen some interest exec solutions. External access attempt in an 'unless' clause and have the exec run /bin/false. This allows it to only output (and fail) on failure

DarylW gravatar imageDarylW ( 2016-03-09 20:26:08 -0600 )edit

Maybe I'm misunderstanding, but this isn't something you would do in puppet code. You would run the agent via cron and put a wrapper around the command to check the status of your internet connection.

lavaman gravatar imagelavaman ( 2016-03-10 14:41:41 -0600 )edit