Skip to content

Instantly share code, notes, and snippets.

@h0tw1r3
Last active October 26, 2022 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h0tw1r3/96ee76320e888299e594880f8fa4bf13 to your computer and use it in GitHub Desktop.
Save h0tw1r3/96ee76320e888299e594880f8fa4bf13 to your computer and use it in GitHub Desktop.
Deploy nessus agent with Puppet
class nessusagent (
String $agent_key,
Array[String] $agent_groups = ['All'],
String $agent_name = $facts['networking']['hostname'],
String $nessus_host = 'cloud.tenable.com',
Integer $nessus_port = 443,
String $package_name = 'NessusAgent',
Hash $package_params = {
ensure => 'latest',
},
) {
package { $package_name,
* => $package_params,
}
~> service { 'nessusagent':
ensure => running,
enabled => true,
}
-> exec { 'link-nessus-agent':
command => sprintf('/opt/nessus_agent/sbin/nessuscli agent link --key=%s --name="%s" --groups="%s" --host="%s" --port=%d',
$agent_key, $agent_name, join($agent_groups, ','),
$nessus_host, $nessus_port,
),
unless => '/opt/nessus_agent/sbin/nessuscli agent status',
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment