Last active
October 26, 2022 17:35
-
-
Save h0tw1r3/96ee76320e888299e594880f8fa4bf13 to your computer and use it in GitHub Desktop.
Deploy nessus agent with Puppet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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