Skip to content

Instantly share code, notes, and snippets.

@groob
Last active December 24, 2015 22:39
Show Gist options
  • Save groob/6874282 to your computer and use it in GitHub Desktop.
Save groob/6874282 to your computer and use it in GitHub Desktop.
class bootstrap::nosslsearch {
host { 'www.google.com':
ensure => 'present',
ip => $::nosslsearch_ip_address,
target => '/etc/hosts',
notify => Exec["flushdnscache"],
}
exec { 'flushdnscache':
command => "/usr/bin/dscacheutil -flushcache",
refreshonly => true,
}
}
#nosslsearch_ip_address.rb
Facter.add(:nosslsearch_ip_address) do
confine :kernel => "Darwin"
setcode do
Facter::Util::Resolution.exec("/usr/bin/dig nosslsearch.google.com | grep google.com | tail -n 1 | awk '{print $5}'")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment