Skip to content

Instantly share code, notes, and snippets.

@mths0x5f
Last active December 28, 2016 20:03
Show Gist options
  • Save mths0x5f/d913116fad4dfc1a687bc69eb446cefa to your computer and use it in GitHub Desktop.
Save mths0x5f/d913116fad4dfc1a687bc69eb446cefa to your computer and use it in GitHub Desktop.
# Dependências
mod 'puppetlabs-apache', '1.11.0'
mod 'puppetlabs-apt', '2.3.0'
mod 'puppetlabs-concat', '2.2.0'
mod 'puppetlabs-firewall', '1.8.1'
mod 'puppetlabs-mysql', '3.10.0'
mod 'puppetlabs-pe_gem', '0.2.0'
mod 'puppetlabs-postgresql', '4.8.0'
mod 'puppetlabs-ruby', '0.6.0'
mod 'puppet-staging', '2.1.0'
mod 'puppetlabs-stdlib', '4.14.0'
mod 'camptocamp-systemd', '0.4.0'
# Módulo gerenciador do SELinux
mod 'puppet-selinux', '0.7.0'
# Módulo que ativa o repositório EPEL
mod 'stahnma-epel', '1.2.2'
# Módulo para gerenciar o resolv.conf
mod 'ghoneycutt-dnsclient', '3.5.2'
# Módulo de instalação e configuração do Zabbix
mod 'puppet-zabbix', '2.6.1'
# Desativar SELinux e firewalld em todos os nodes
class { 'selinux':
mode => 'disabled',
}
service { 'firewalld':
ensure => 'stopped',
enable => false,
}
# Inclui repo EPEL
include epel
# Configura o(s) servidor(es) DNS a ser(em) usado(s)
class { 'dnsclient':
search => 'puppet',
nameservers => ['192.168.0.49'],
}
node 'agent1.puppet' {
# Node com Zabbix Server e Web
class { 'apache':
mpm_module => 'prefork',
}
class { 'apache::mod::php': }
# Este módulo remove o arquivo /etc/httpd/conf.d/zabbix.conf e cria outro,
# gerenciado por ele, em seu lugar: /etc/httpd/conf.d/25-agent1.puppet.conf
class { 'zabbix::web':
zabbix_version => '3.0',
zabbix_url => 'agent1.puppet', # domínio para acessar via navegador
zabbix_server => 'agent1.puppet',
zabbix_timezone => 'America/Sao_Paulo',
apache_php_max_execution_time => '14400',
apache_php_memory_limit => '2048M',
apache_php_post_max_size => '32M',
apache_php_upload_max_filesize => '4M',
apache_php_max_input_time => '14400',
database_host => 'agent2.puppet',
database_type => 'mysql',
}
class { 'mysql::client': }
# Módulo que instala o Zabbix Server e
# gerencia o arquivo /etc/zabbix/zabbix_server.conf
class { 'zabbix::server':
zabbix_version => '3.0',
database_host => 'agent2.puppet',
database_type => 'mysql',
# parametros alteraveis (em máq. com pouca RAM, não sobe)
logfilesize => '0',
startpollers => '400',
startpollersunreachable => '200',
startpingers => '400',
startdiscoverers => '100',
maxhousekeeperdelete => '5000',
cachesize => '6G',
historycachesize => '2G',
historyindexcachesize => '2G',
valuecachesize => '6G',
# ----------------------------------------------
manage_firewall => true,
}
class { 'zabbix::agent':
zabbix_version => '3.0',
server => 'agent1.puppet, agent3.puppet',
}
}
node 'agent2.puppet' {
# Node com MySQL
class { 'mysql::server':
override_options => {
'mysqld' => {
'bind_address' => '192.168.0.47', # endereço da máquina
# parametros alteraveis (em máq. com pouca RAM, não sobe)
'innodb_buffer_pool_size' => '12G',
'innodb_log_file_size' => '14G',
'max_connections' => '1500',
'slow_query_log' => '1',
'slow_query_log_file' => '/var/log/mysql/slow.log',
'long_query_time' => '10',
'log_queries_not_using_indexes' => '1',
'event_scheduler' => 'ON',
'plugin-load' => 'thread_pool.so',
},
},
}
class { 'zabbix::database':
database_type => 'mysql',
zabbix_server => 'agent1.puppet',
zabbix_web => 'agent1.puppet',
}
class { 'zabbix::agent':
zabbix_version => '3.0',
server => 'agent1.puppet, agent3.puppet',
}
}
node 'agent3.puppet' {
# Node(s) com Zabbix Proxy
file { '/var/lib/sqlite':
ensure => 'directory',
mode => '0777',
}
# Módulo que instala o Zabbix Proxy e
# gerencia o arquivo /etc/zabbix/zabbix_proxy.conf
class { 'zabbix::proxy':
zabbix_version => '3.0',
zabbix_server_host => 'agent1.puppet',
logfilesize => '0',
database_type => 'sqlite',
database_name => '/var/lib/sqlite/zabbix_proxy.db',
snmptrapper => '1',
# parametros alteraveis (em máq. com pouca RAM, não sobe)
startpollers => '500',
startpollersunreachable => '200',
startpingers => '200',
startdiscoverers => '50',
cachesize => '2G',
historycachesize => '1G',
historyindexcachesize => '512M',
# ----------------------------------------------
manage_firewall => true,
}
class { 'zabbix::agent':
zabbix_version => '3.0',
server => 'agent1.puppet, agent3.puppet',
serveractive => 'agent1.puppet, agent3.puppet',
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment