Skip to content

Puppet open source

Amy Buck edited this page Nov 20, 2018 · 7 revisions

This use case describes how to use Puppet to configure systems — each system is connected to a server.

1. Install the Puppet master on an external server and configure it to manage systems running the software by following the instructions at www.puppetlabs.com.

2. Install and configure the Puppet agent on both systems by following the instructions at www.puppetlabs.com.

3. Verify if the Puppet master can communicate with the Puppet agents through the management network.

Sample configuration — manifest managing two systems

node 'R1.dell.com' {
   $int_enabled = true
   $int_loopback = '2.2.2.2'
   $int_layer3 = {
      e101-019-0  => {'int'=>'e101-019-0', 'address' => '19.0.0.1', 'netmask' => '255.255.255.0', 'cidr_netmask' => 24},
      e101-020-0  => {'int'=>'e101-020-0', 'address' => '20.0.0.1', 'netmask' => '255.255.255.0', 'cidr_netmask' => 24},
   }

   $bgp = {
       myasn => 65000,
       peergroupv4 => [ { name => 'R2', asn => 65000, peers => [ '19.0.0.2','20.0.0.2' ] } ]
   }
   include ibgp::switch
}

node 'R2.dell.com' {
   $int_enabled = true
   $int_loopback = '3.3.3.3'
   $int_layer3 = {
       e101-019-0  => { 'int'=> 'e101-019-0', 'address' => '19.0.0.2', 'netmask' => '255.255.255.0', 'cidr_netmask' => 24 },
       e101-020-0​  => { 'int'=> ' e101-020-0','address' => '21.0.0.1', 'netmask' => '255.255.255.0', 'cidr_netmask' => 24 },
   }

   $bgp = {
       myasn => 65000,
       peergroupv4 => [ { name => 'R1', asn => 65000, peers => [ '19.0.0.1','20.0.0.1' ] } ]
   }
   include ibgp::switch
}

Sample configuration — class definitions

class ibgp::switch {
   include ibgp::quagga
}

class ibgp::quagga {
   service { 'quagga':
       ensure    => running,
       hasstatus => false,
       enable    => true,
   }

   file { '/etc/quagga/daemons':
       owner  => quagga,
       group  => quagga,
       source => 'puppet:///modules/ibgp/quagga_daemons',
       notify => Service['quagga']
   }

   file { '/etc/quagga/Quagga.conf':
       owner   => root,
       group   => quaggavty,
       mode    => '0644',
       content => template('ibgp/Quagga.conf.erb'),
       notify  => Service['quagga']
   }
}

Sample configuration — FRR configuration file

! This file is managed by Puppet

hostname zebra
log file /var/log/frr/zebra.log
hostname ospfd
log file /var/log/frr/ospfd.log
log timestamp precision 6
hostname bgpd
log file /var/log/frr/bgpd.log
!
password cn321
enable password cn321
!
<%   @int_layer3.each_pair do |layer3, options| -%>
interface &lt;%= options["int"] %>
ip address &lt;%=options["address"]%>/<%=options["cidr_netmask"] %>
no shutdown
<%     end -%>

route-id <%= @int_loopback %>
<% if @bgp -%>
router bgp <%= @bgp["myasn"] %>
 maximum-paths ibgp 4
 bgp router-id <%= int_loopback %>
 bgp log-neighbor-changes
 network <%= @int_loopback %>/32
<%     @int_bridges.each_pair do |bridge, options| -%>    network <%= options["address"] %>/<%= options["cidr_netmask"] %>
<%     end -%>
<%   @bgp["peergroupv4"].each do |peergroup| -%>
 neighbor <%= peergroup["name"] %> peer-group
 neighbor <%= peergroup["name"] %> remote-as <%= peergroup["asn"] %>
<%     if peergroup["name"]["routereflectorclient"] -%>
 neighbor <% peergroup["name"] %> route-reflector-client
<%     end -%>
<%     peergroup["peers"].each do |peer| -%>
 neighbor <%= peer %> peer-group <%= peergroup["name"] %>
<%     end -%>
<%   end -%>
<% end -%>
!
<% if @int_unnumbered -%>
<%   @int_unnumbbers.each do |interface| -%>
 no passive-interface <%= interface %>
<%   end -%>
 network <%= @int_loopback >/32 area 0.0.0.0
<%   if @hostnetranges and @is_leaf -%>
<%     @hostnetranges.each do |hostnetrange| -%>
 network <%= hostnetrange %> area 0.0.0.0
<%     end -%>
<%   end -%>  
<% end -%>

Sample configuration — FRR daemons file

zebra=yes
bgpd=yes
ospfd=no
ospf6d=no
ripd=no
ripngd=no
isisd=no
babeld=no
Clone this wiki locally