voxpupuli / puppet-zabbix

Puppet module for creating and maintaining zabbix components with puppet.
https://forge.puppet.com/puppet/zabbix
Apache License 2.0
80 stars 228 forks source link

Allow MSI package install on Windows #790

Closed spicyprogramming closed 2 years ago

spicyprogramming commented 2 years ago

Pull Request (PR) description

This change would allow Zabbix agent deployments on systems with no internet access (air gapped networks or or otherwise blocked)

Sample usage:

$tmpdir = $facts['windows_env']['TMP'];

download_file { 'get zabbix-installer.msi':
  url                   => "https://<internal>/zabbix_agent-${zabbix_version}-windows-amd64-openssl.msi",
  destination_directory => $tmpdir,
  destination_file      => "zabbix_agent-windows-amd64-openssl.msi",
}

class { 'zabbix::agent':
  zabbix_version          => $zabbix_version,
  manage_resources        => true,
  manage_choco            => false,
  zabbix_package_state    => present,
  zabbix_package_provider => 'windows',
  zabbix_package_source   => "${tmpdir}/zabbix_agent-windows-amd64-openssl.msi",
}

This Pull Request (PR) fixes the following issues

This is a new feature

root-expert commented 2 years ago

Hey @spicyprogramming ! Thank for the PR! Take a look at the inline comments. Also: I think we should add an example usage of this on README, and we need some unit tests for this.

spicyprogramming commented 2 years ago

we need some unit tests for this

Could you give me some guidance @root-expert ? I've never done anything like this for puppet. Thanks

bastelfreak commented 2 years ago

hey @spicyprogramming , thanks for the PR. Can you add the windows versions this is supposed to work on to the metadata.json?

spicyprogramming commented 2 years ago

@bastelfreak AFAIK this should work on "Any" version, according to the official website:

image

spicyprogramming commented 2 years ago

Will look into test failures later today

bastelfreak commented 2 years ago

the CI errors are fixed on master. can you rebase against our latest master branch? (please don't create a merge commit)

spicyprogramming commented 2 years ago

/ping

Is there anything else left to do to move this forward?

root-expert commented 2 years ago

/ping

Is there anything else left to do to move this forward?

We need some unit tests. Take a look here on how to write them properly. The test should be added here. A good start is to copy an old test and adapt it to your needs.

If you need help you can join on channel #voxpupuli at Libera.Chat or at the Puppet Community Slack. :smile:

root-expert commented 2 years ago

@spicyprogramming Seems your commit email is not associated with your Github account, could fix that before we merge this PR?

spicyprogramming commented 2 years ago

@root-expert fixed. Thanks for helping me out push this through, by the way.