parts of class being skipped :(

asked 2017-10-04 00:24:09 -0600

Anil gravatar image

Hi All,

Please forgive my limited knowledge on puppet. I need some assistance in achieving what most of you would consider a very simple task. I am attempting to install zabbix agent below and modify the configuration file then reload the service. I believe the code is incomplete but i am not sure where the problem is because the agent run in not generating an error. from analysis the package is installed and the service is enabled then nothing else.

My thought process for the class is a follow. 1.Create a repo on the servers 2. install zabbix agent 3. modify the config file 4. reload the service.

The code can be seen below. Thank you in advance for any assistance i really appreciate it.

class zabbixinstall {
case $operatingsystemmajrelease {
        "5": {
                yumrepo { 'zabbix3.4_repo':
                enabled  => 1,
                descr    => 'Zabbix 3.4 Repo Created by Sysad',
                baseurl  => 'http://repo.zabbix.com/zabbix/3.4/rhel/5/$basearch/',
                gpgcheck => 1,
                gpgkey   => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
                         }
                }
        "6": {
                yumrepo { 'zabbix3.4_repo':
                enabled  => 1,
                descr    => 'Zabbix 3.4 Repo Created by Sysad',
                baseurl  => 'http://repo.zabbix.com/zabbix/3.4/rhel/6/$basearch/',
                gpgcheck => 1,
                gpgkey   => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
                         }
                }
        "7": {
                yumrepo { 'zabbix3.4_repo':
                enabled  => 1,
                descr    => 'Zabbix 3.4 Repo Created by Sysad',
                baseurl  => 'http://repo.zabbix.com/zabbix/3.4/rhel/7/$basearch/',
                gpgcheck => 1,
                gpgkey   => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
                         }
                }
        }


        package { 'zabbix-agent':
        ensure  => 'installed',
        require => Yumrepo['zabbix3.4_repo'],
  }
        service { 'zabbix-agent':
        enable => 'true',
        ensure  => running,
        require => Package['zabbix-agent']
        }

        file_line{ 'Append a line to /etc/zabbix/zabbix_agentd.conf':
                path    => '/etc/zabbix/zabbix_agentd.conf',
                line    => "Server=server2.grp.local",
                ensure  => 'present',
                match   => '^Server\=127\.0\.0\.1',
                append_on_no_match  => 'false',
                 }
        file_line{ 'Replace line to /etc/zabbix/zabbix_agentd.conf':
                path    => '/etc/zabbix/zabbix_agentd.conf',
                line    => "ServerActive=server2.grp.local",
                ensure  => 'present',
                match   => '^ServerActive\=127\.0\.0\.1',
                append_on_no_match  => 'false',
                 }


}
edit retag flag offensive close merge delete