Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -*- 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 "puppet-serv" do |serv|
serv.vm.hostname = "puppet-serv.minsk.epam.com"
serv.vm.box = "centos7"
serv.vm.network "private_network", ip: "192.168.10.30"
serv.vm.provider "virtualbox" do |server|
server.name = "puppet-serv"
server.cpus = 2
server.memory = 3000
end

serv.vm.provision "shell", inline: <<-SHELL
sudo rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
sudo yum install -y puppetserver
sudo systemctl restart network
sudo cp /vagrant/autosign.conf /etc/puppetlabs/puppet
sudo systemctl start puppetserver
source ~/.bashrc
puppet module install puppetlabs-mysql --version 3.10.0
sudo cp /vagrant/site.pp /etc/puppetlabs/code/environments/production/manifests
echo " === Provision puppet-serv.minsk.epam.com complete === "
SHELL
end

config.vm.define "node1" do |node1|
node1.vm.hostname = "node1.minsk.epam.com"
node1.vm.box = "centos7"
node1.vm.network "private_network", ip: "192.168.10.40"
node1.vm.provider "virtualbox" do |node|
node.name = "node1"
node.cpus = 1
node.memory = 1024

end

node1.vm.provision "shell", inline: <<-SHELL
sudo rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
yum install -y puppet-agent
sudo systemctl restart network
echo "server = puppet-serv.minsk.epam.com" >> /etc/puppetlabs/puppet/puppet.conf
echo "192.168.10.30 puppet-serv.minsk.epam.com" >> /etc/hosts
sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true
echo " === Provision node1.minsk.epam.com complete === "
SHELL

end

end
1 change: 1 addition & 0 deletions autosign.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.minsk.epam.com
15 changes: 15 additions & 0 deletions puppet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://docs.puppetlabs.com/puppet/latest/reference/config_important_settings.html
# - https://docs.puppetlabs.com/puppet/latest/reference/config_about_settings.html
# - https://docs.puppetlabs.com/puppet/latest/reference/config_file_main.html
# - https://docs.puppetlabs.com/puppet/latest/reference/configuration.html
[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 = puppetdb
4 changes: 4 additions & 0 deletions puppetdb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[main]
server_urls = https://puppet-serv.minsk.epam.com:8081/
soft_write_failure = false

8 changes: 8 additions & 0 deletions site.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node 'puppet-serv.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]'] } ] }
}

25 changes: 25 additions & 0 deletions site_prod.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
node 'node1.minsk.epam.com' {
class { 'nginx': }

class { '::mysql::server':
root_password => 'password',
}

mysql_database { 'prod_mdb':
ensure => present,
charset => 'utf8',
}

mysql_user { 'prod_user@localhost':
ensure => present,
password_hash => mysql_password('prod_password'),
}

mysql_grant { 'prod_user@localhost/prod_mdb.*':
ensure => present,
options => ['GRANT'],
privileges => ['ALL'],
table => 'prod_mdb.*',
user => 'prod_user@localhost',
}
}