voxpupuli / puppet-zabbix

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

feat: allow uninstalling the Zabbix agent #959

Open coreone opened 1 week ago

coreone commented 1 week ago

Pull Request (PR) description

Add the ability to remove the Zabbix agent from a system using the ensure parameter.

feat: add tests for new "ensure" parameter in zabbix::agent

Valantin commented 1 week ago

Hi @coreone have you tried with zabbix::agent::zabbix_package_state: purged ?

coreone commented 1 week ago

I have done that, and it removes the package(s), but it doesn't remove the config file. Normally, I would just leave the config file there, but when you apply the agent class with the following parameters to a host that hasn't had any packages installed, it causes a runtime error when applying the catalog because the /etc/zabbix directory doesn't exist (because the package doesn't exist, and that's what creates the directory) and it still tries to write the config file.

manage_repo => false,
service_enable => false,
service_ensure => 'stopped',
zabbix_package_state => 'absent',