diff --git a/README.md b/README.md index 6f000ce..754399b 100644 --- a/README.md +++ b/README.md @@ -1 +1,7 @@ -# lesson13 \ No newline at end of file +# lesson13 + +2 folders for different nodes (and conf files there): +srv - puppetserver +agent - puppet agent + +Folder pics for screenshots diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..8660b4a --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,44 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + + config.vm.define "srv" do |srv| + srv.vm.hostname = "srv" + srv.vm.box = "centos/7" + srv.vm.network "private_network", ip: "192.168.100.100" + srv.vm.provider "virtualbox" do |main| + main.name = "srv" + main.memory = 4096 + + + srv.vm.provision "shell", inline:"rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm; yum install -y puppetserver" + srv.vm.provision "shell", inline: "yum install -y facter vim" + +end +end + + config.vm.define "agent" do |agent| + agent.vm.hostname = "agent" + agent.vm.box = "centos/7" + agent.vm.network "private_network", ip: "192.168.100.101" + agent.vm.provider "virtualbox" do |node| + node.name = "agent" + node.memory = 512 + + agent.vm.provision "shell", inline:"rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm; yum install -y facter vim puppet" +end +end + + +#config.vm.provision "shell", inline: "yum install -y epel-release" +#config.vm.provision "shell", inline: "yum install -y java puppet facter nano vim" +#config.vm.provision "shell", inline: "setenforce permissive" +#config.vm.provision "shell", inline: "puppet apply -e 'include exittask' --modulepath=/vagrant" + + +end diff --git a/agent/puppet.conf b/agent/puppet.conf new file mode 100644 index 0000000..cb6caab --- /dev/null +++ b/agent/puppet.conf @@ -0,0 +1,4 @@ + +server = srv.minsk.epam.com +certname = agent.minsk.epam.com + diff --git a/pics/expl1.png b/pics/expl1.png new file mode 100644 index 0000000..ef21d95 Binary files /dev/null and b/pics/expl1.png differ diff --git a/pics/expl2.png b/pics/expl2.png new file mode 100644 index 0000000..80b8b43 Binary files /dev/null and b/pics/expl2.png differ diff --git a/pics/expl3.png b/pics/expl3.png new file mode 100644 index 0000000..64093f0 Binary files /dev/null and b/pics/expl3.png differ diff --git a/srv/hosts b/srv/hosts new file mode 100644 index 0000000..fa0e70f --- /dev/null +++ b/srv/hosts @@ -0,0 +1,7 @@ +127.0.0.1 srv srv +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +# ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 + +192.168.100.100 srv.minsk.epam.com puppet +192.168.100.101 agent.minsk.epam.com + diff --git a/srv/prod/hosts b/srv/prod/hosts new file mode 100644 index 0000000..fa0e70f --- /dev/null +++ b/srv/prod/hosts @@ -0,0 +1,7 @@ +127.0.0.1 srv srv +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +# ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 + +192.168.100.100 srv.minsk.epam.com puppet +192.168.100.101 agent.minsk.epam.com + diff --git a/srv/prod/site.pp b/srv/prod/site.pp new file mode 100644 index 0000000..d35e953 --- /dev/null +++ b/srv/prod/site.pp @@ -0,0 +1,27 @@ +node 'agent.minsk.epam.com' { + class { '::mysql::server': + root_password => 'root', + override_options => { + 'mysqld' => { 'max_connections' => '1024' } + }, + } + include ::mysql::server::account_security + + mysql_database { 'prod_mdb': + ensure => present, + charset => 'utf8', + } + + mysql_user { 'prod_user@localhost': + ensure => present, + password_hash => mysql_password('Epam_2011'), + } + + mysql_grant { 'prod_user@localhost/prod_mdb.*': + ensure => present, + options => ['GRANT'], + privileges => ['ALL'], + table => 'prod_mdb.*', + user => 'prod_user@localhost', + } +} diff --git a/srv/production/config.ini b/srv/production/config.ini new file mode 100644 index 0000000..e69de29 diff --git a/srv/production/hosts b/srv/production/hosts new file mode 100644 index 0000000..fa0e70f --- /dev/null +++ b/srv/production/hosts @@ -0,0 +1,7 @@ +127.0.0.1 srv srv +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +# ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 + +192.168.100.100 srv.minsk.epam.com puppet +192.168.100.101 agent.minsk.epam.com + diff --git a/srv/production/puppet.conf b/srv/production/puppet.conf new file mode 100644 index 0000000..0b61bf7 --- /dev/null +++ b/srv/production/puppet.conf @@ -0,0 +1,9 @@ +[master] +vardir = /opt/puppetlabs/server/data/puppetserver +logdir = /var/log/puppetlabs/puppetserver +rundir = /var/run/puppetlabs/puppetserver +pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid +codedir = /etc/puppetlabs/code +storeconfigs = true +storeconfigs_backend = puppetdb +reports = store,puppetdb diff --git a/srv/production/puppetdb.conf b/srv/production/puppetdb.conf new file mode 100644 index 0000000..a392932 --- /dev/null +++ b/srv/production/puppetdb.conf @@ -0,0 +1,3 @@ +[main] +server_urls = https://srv.minsk.epam.com:8081/ +soft_write_failure = false diff --git a/srv/production/site.pp b/srv/production/site.pp new file mode 100644 index 0000000..de32936 --- /dev/null +++ b/srv/production/site.pp @@ -0,0 +1,9 @@ +node srv.minsk.epam.com { + class { 'puppetdb': } + class { 'puppetdb::master::config': } + class {'::puppetexplorer': + vhost_options => { + rewrites => [ { rewrite_rule => ['^/api/metrics/v1/mbeans/puppetlabs.puppetdb.query.population:type=default,name=(.*)$ https://%{HTTP_HOST}/api/metrics/v1/mbeans/puppetlabs.puppetdb.population:name=$1 [R=301,L]'] } ] } + } +} +