Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AntonKaminski_exittask #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .vagrant/machines/node1/virtualbox/action_provision
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5:fcb3052c-6547-42d9-82cc-2c928fd3a42c
1 change: 1 addition & 0 deletions .vagrant/machines/node1/virtualbox/action_set_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1492603052
1 change: 1 addition & 0 deletions .vagrant/machines/node1/virtualbox/creator_uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1000
1 change: 1 addition & 0 deletions .vagrant/machines/node1/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fcb3052c-6547-42d9-82cc-2c928fd3a42c
1 change: 1 addition & 0 deletions .vagrant/machines/node1/virtualbox/index_uuid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b99bf71758a24280835b37827dedc80f
27 changes: 27 additions & 0 deletions .vagrant/machines/node1/virtualbox/private_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA1/WHPC0eamkag9+3tByGH3g1ioFlugu1aDRW07Obb6Ww3fAX
Dw1aHAZaoO/tUNMMDDtmw7By5hGUYy5dEbaAH6LraqARqu+NGcpIbULlMOMeMi28
Z6E3GOirCbbmbfZFBWud44pv11vUhASYITh7SDhgfxsyx7vjRMgmlthNr5CW6yh0
6EvaQB4vLUM9/hvHL1L3Ju7wHlNDg742TcDioPULcrnu1wCtgKfQ4J5ubxn5S5rK
gZAk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4dgMJvS6rFmtQKMIYs
Fs3jDjBV9qi8GXoULXgGlSwuwcvCCaW6vPB0G8jAp1XXzVe8cECWFuOO7FAvcF8H
8+gusQKBgEQtJwpjiETZ1b8O+17u0rjCq2x2QranyJW3MsXAECGFfDStm8JTOwvG
sXwkOgwJazx/IUs8c50js1l+7hbosQl0BEuy8GmZXa0R6Tx7a40qjHaA4lhfAph4
9hUcDKUZq7/DwehVUwfTFB4Bw7erloumU5hc/fxdx5ZgcuRaPCRJ
-----END RSA PRIVATE KEY-----
1 change: 1 addition & 0 deletions .vagrant/machines/node1/virtualbox/synced_folders
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/student/puppet/exittask/puppet","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}}
1 change: 1 addition & 0 deletions .vagrant/machines/puppet-serv/virtualbox/action_provision
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5:bbc8aa11-9e89-4953-935e-0ac817778159
1 change: 1 addition & 0 deletions .vagrant/machines/puppet-serv/virtualbox/action_set_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1492596370
1 change: 1 addition & 0 deletions .vagrant/machines/puppet-serv/virtualbox/creator_uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1000
1 change: 1 addition & 0 deletions .vagrant/machines/puppet-serv/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bbc8aa11-9e89-4953-935e-0ac817778159
1 change: 1 addition & 0 deletions .vagrant/machines/puppet-serv/virtualbox/index_uuid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a4d9b88e929543929aff1d8adadd5eb7
27 changes: 27 additions & 0 deletions .vagrant/machines/puppet-serv/virtualbox/private_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAuFJCLCv9qTWfynPf8ci/j6s5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xS8SaOVoUXzZYOcFaGLtWGeZ5nBPh+NPH4KYZqxvi
0o+D+8w4sLSHxcLvDHCdCIbr2+BR77NNd7ZDJRRGW05C83oTdoh+qz1Uv2vvXbSm
kHKl1/qx083L1bAoevGijcsCgYBb9sktEmHQoAnQbj7omWyZtV6Na4ba/gdaJYc8
i2rJ5HBQo36nb96AUhMbkqHGojX8aySP18/Qi4rBB2dQrtdfrJi4iSuCc/piHSKi
WtyDv5PGd3ZMFAS+UYTPcU7fTAbwPwZNHYHkV1pGSQrwmTl9dWIx7+YfglRtACDt
QPl95wKBgARfo+VP6QHnYfgS8NNgFJwOt0uET2pNi2CHB1mFLGHEP4es/7Ql/kie
A2kz9448SGLy1iZ6kVyRT110FdH64uljNlfsCthhe71qP2QSSux/hl5woQ+yCjYP
8kRDGJfUPKXopRV35pLRr7ZaSiLHJNMfeBpxz7cBbSqTlP21mZNw
-----END RSA PRIVATE KEY-----
1 change: 1 addition & 0 deletions .vagrant/machines/puppet-serv/virtualbox/synced_folders
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/student/puppet/exittask/puppet","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}}}
52 changes: 52 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- 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.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
yum install -y epel-release.noarch
yum install -y puppet
echo -e 'DNS1=192.168.10.40\nPEERDNS=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth1
sudo systemctl restart network
source ~/.bashrc
puppet apply /vagrant/site.pp --modulepath=/vagrant/modules
echo " === Provision puppet-serv.minsk.epam.com complete === "
SHELL
end

config.vm.define "node1" do |node1|
node1.vm.hostname = "node1.minsk.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
yum install -y epel-release.noarch
yum install -y puppet
sudo systemctl restart network
source ~/.bashrc
puppet apply /vagrant/site.pp --modulepath=/vagrant/modules
echo " === Provision node1.minsk.epam.com complete === "
SHELL

end

end
6 changes: 6 additions & 0 deletions dnsmasq/files/dnsmasq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
listen-address=192.168.10.40
no-hosts
interface=eth1

address=/node1.minsk.com/192.168.10.40
address=/puppet-serv.minsk.com/192.168.10.30
3 changes: 3 additions & 0 deletions dnsmasq/files/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.30 puppet-serv.minsk.com
31 changes: 31 additions & 0 deletions dnsmasq/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class dns{
$ip='8.8.4.4'

package { 'dnsmasq':
ensure => '2.66-21.el7',
}
file { 'Replace_dnsmasq.conf':
backup => false,
source => 'puppet:///modules/dns/dnsmasq.conf',
path => '/etc/dnsmasq.conf',
owner => 'root',
group => 'root',
mode => '0755',
notify => Package['dnsmasq']
}
file { 'Replace_resolv.conf':
backup => false,
content => template('dns/resolv.erb'),
path => '/etc/resolv.conf',
owner => 'root',
group => 'root',
mode => '0755',
notify => Service['dnsmasq']

}
service { 'dnsmasq':
ensure => 'running',
enable => true
}
}

2 changes: 2 additions & 0 deletions dnsmasq/templates/resolver.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

nameserver <%= @ip %>
8 changes: 8 additions & 0 deletions modules/mymod/files/dnsmasq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
listen-address=192.168.10.40
no-hosts
interface=eth1

address=/node1.minsk.com/192.168.10.40
address=/puppet-serv.minsk.com/192.168.10.30


4 changes: 4 additions & 0 deletions modules/mymod/files/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
127.0.0.1 node1.minsk.com node1
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.30 puppet-serv.minsk.com
2 changes: 2 additions & 0 deletions modules/mymod/files/resolv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

nameserver <%= @ip %>
5 changes: 5 additions & 0 deletions modules/mymod/lib/facter/is_puppetmaster.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Facter.add(:is_puppetmaster) do
setcode do
Facter.value(:hostname).include? 'puppet-serv'
end
end
31 changes: 31 additions & 0 deletions modules/mymod/manifests/agent.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#Install puppet-agent
class mymod::agent{
exec { 'Register_repo':
command => 'rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm',
path => ['/usr/bin', '/usr/sbin',],
}
package { 'puppet-agent':
ensure => 'latest',
require => Exec['Register_repo']
}
service { 'puppet':
ensure => 'running',
require => Package['puppet-agent'],
}
file { 'Replace_hosts':
backup => false,
source => '/vagrant/modules/mymod/files/hosts',
path => '/etc/hosts',
owner => 'root',
group => 'root',
mode => '0644',
}
exec { '/etc/puppetlabs/puppet/puppet.conf':
command => 'echo "server = puppet-serv.minsk.com" >> /etc/puppetlabs/puppet/puppet.conf',
path => ['/usr/bin', '/usr/sbin',],
require => Service['puppet'],
subscribe => Package['puppet-agent'],
refreshonly => true
}

}
12 changes: 12 additions & 0 deletions modules/mymod/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#init Mymod
class mymod {

$puppet_version='2.7.2-1.el7'

if $::is_puppetmaster == 'true' {
include mymod::master
}
else {
include mymod::agent
}
}
22 changes: 22 additions & 0 deletions modules/mymod/manifests/master.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#Install puppet-server
class mymod::master{
exec { 'Register_repo':
command => 'rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm',
path => ['/usr/bin', '/usr/sbin',],
}
package { 'puppetserver':
ensure => $::mymod::puppet_version,
}
file { '/etc/puppetlabs/puppet/autosign.conf':
ensure => file,
content => template('mymod/autosign.erb'),
owner => root,
group => root,
mode => '0755',
require => Package['puppetserver']
}
service { 'puppetserver':
ensure => 'running',
require => File['/etc/puppetlabs/puppet/autosign.conf'],
}
}
9 changes: 9 additions & 0 deletions modules/mymod/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "mymod",
"version": "1.0.0",
"author": "Anton Kaminski",
"summary": "Deploy puppet-agent and puppetserver",
"license": "Freeware",
"source": "https://github.com/lestatk0",
"project_page": "https://github.com/lestatk0",
}
1 change: 1 addition & 0 deletions modules/mymod/templates/autosign.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.<%= @domain %>
3 changes: 3 additions & 0 deletions site.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node default {
include 'mymod'
}