Junos specific Provider code for "netdev_stdlib". Netdev is a vendor-neutral network abstraction framework developed by Juniper Networks and contributed freely to the DevOps community.
Netdev is a vendor-neutral network abstraction framework developed by
Juniper Networks and contributed freely to the DevOps community
This module contains the Junos specific Provider code implementing
the Resource Types defined in netdevops/netdev_stdlib
This module has been tested against Puppet agent 2.7.19 and 3.6.1. Here is a short example of a static manifest for a Junos EX switch. This example assumes that you’ve also installed the Puppet stdlib module as this example uses the keys function.
node "myswitch1234.mycorp.com" {
netdev_device { $hostname: }
$vlans = {
'Blue' => { vlan_id => 100, description => "This is a Blue vlan" },
'Green' => { vlan_id => 101, description => "This is a Green vLAN" },
'Purple' => { vlan_id => 102, description => "This is a Puple vlan" },
'Red' => { vlan_id => 103, description => "This is a Red vlan" },
'Yellow' => { vlan_id => 104, description => "This is a Yellow vlan" }
}
create_resources( netdev_vlan, $vlans )
$access_ports = [
'ge-0/0/0',
'ge-0/0/1',
'ge-0/0/2'
]
$uplink_ports = [
'xe-0/0/0',
'xe-0/0/2'
]
netdev_l2_interface { $access_ports:
untagged_vlan => Blue
}
netdev_l2_interface { $uplink_ports:
tagged_vlans => keys( $vlans )
}
# service variables passed in template file
$services = [ [ 'ftp' ], [ 'ssh' ], [ 'telnet' ], [ 'netconf', 'ssh' ] ]
netdev_stdlib_junos::apply_group{ "services_group":
template_path => "netdev_stdlib_junos/services.set.erb",
active => true,
ensure => present,
}
# Syslog variable passed in 'syslog.text.erb' template file
$syslog_names = {
'messages' => [ { 'facility' => 'any', 'level' => 'critical' }, { 'facility' => 'authorization', 'level' => 'info' } ] ,
'interactive-commands' => [ { 'facility' => 'interactive-commands', 'level' => 'error'} ]
}
netdev_stdlib_junos::apply_group{ "syslog_group":
template_path => "netdev_stdlib_junos/syslog.text.erb",
active => true,
ensure => present,
}
# Event-policy variable passed in 'event-options.xml.erb' template file
$policy = {
'p1' => {
'events' => [ 'TEST' ],
'action' => 'then',
'event-script' => 'hello.slax'
}
}
$event_script = [ 'hello.slax' ]
# file resource copies the file hello.slax from master to agent
file { '/var/db/scripts/event/hello.slax':
mode => 0644,
source => "puppet:///modules/netdev_stdlib_junos/junoscripts/event/hello.slax",
}
# Configure event policy and event script
netdev_stdlib_junos::apply_group{ "event_options_group":
template_path => "netdev_stdlib_junos/event-options.xml.erb",
active => true,
ensure => present,
}
}
See RESOURCE-STDLIB.md for documentation and usage examples
Juniper Networks is actively contributing to and maintaining this repo. Please contact [email protected] for any queries.
Contributors:
Former Contributors:
See LICENSE