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
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# lesson12
## lesson12

All files that were used during provision are uploaded onto repo.
vagrant_up.txt contains output of vagrant provision.

Check db connectivity after provision:
Inline-style:
![alt text](https://github.com/shreben/lesson12/blob/master/mysql_client.png)
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 :

Vagrant.configure('2') do |config|
# define box to use
config.vm.box = 'sbeliakou/centos-7.2-x86_64'

# define puppet master server
config.vm.define 'master' do |master|
master.vm.hostname = 'master.lab'
master.vm.network 'private_network', ip: '192.0.0.100'
master.vm.provider 'virtualbox' do |v|
v.name = 'master'
v.memory = 3072
v.cpus = 1
v.linked_clone = true
end
master.vm.provision 'shell', inline: <<-SHELL
nmcli connection reload
systemctl restart network.service
grep client /etc/hosts
[ $? -ne 0 ] && echo "192.0.0.105 client.lab" >> /etc/hosts
rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
yum install -y puppetserver
/bin/cp /vagrant/site.pp /etc/puppetlabs/code/environments/production/manifests
/bin/cp /vagrant/autosign.conf /etc/puppetlabs/puppet/
systemctl restart puppetserver
source ~/.bashrc
puppet module install puppetlabs-mysql --version 3.10.0
SHELL
end

# define puppet client vm
config.vm.define 'client' do |client|
client.vm.hostname = 'client.lab'
client.vm.network 'private_network', ip: '192.0.0.105'
client.vm.provider 'virtualbox' do |v|
v.name = 'client'
v.memory = 1024
v.cpus = 1
v.linked_clone = true
end
client.vm.provision 'shell', inline: <<-SHELL
nmcli connection reload
systemctl restart network.service
grep master /etc/hosts
[ $? -ne 0 ] && echo "192.0.0.100 master.lab" >> /etc/hosts
rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
yum install -y puppet-agent
/bin/cp /vagrant/puppet.conf /etc/puppetlabs/puppet/
source ~/.bashrc
puppet agent -t
SHELL
end
end
1 change: 1 addition & 0 deletions autosign.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client.lab
Binary file added mysql_client.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions puppet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[main]
certname = client.lab
server = master.lab
environment = production
runinterval = 3m
47 changes: 47 additions & 0 deletions site.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# node definitions.)

## Active Configurations ##

# Disable filebucket by default for all File resources:
File { backup => false }

# DEFAULT NODE
# Node definitions in this file are merged with node data from the console. See
# http://docs.puppetlabs.com/guides/language_guide.html#nodes for more on
# node definitions.

# The default node definition matches any node lacking a more specific node
# definition. If there are no other nodes in this file, classes declared here
# will be included in every node's catalog, *in addition* to any classes
# specified in the console for that node.

node default {
# This is where you can declare classes for all nodes.
# Example:
# class { 'my_class': }
notify { "Node ${::fqdn} is up and running!": }
}

node 'client.lab' {
class { '::mysql::server':
root_password => 'password',
}

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

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

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