Created
February 3, 2017 03:56
-
-
Save natemccurdy/77c6c5e5275402bb1a1df12bbe1e29db to your computer and use it in GitHub Desktop.
Build cisco device.conf with epp, iteration, and magic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#THIS FILE IS MANAGED BY PUPPET | |
<% $device::data.each | $switch | { -%> | |
[<%= $switch['certname'] %>] | |
type cisco | |
url ssh://<%= $switch['username'] %>:<%= $switch['password'] %>@<%= $switch['hostname'] %> | |
<% } -%> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = [ | |
{ | |
'certname' => 'switch1', | |
'username' => 'larry', | |
'password' => 'hunter2', | |
'hostname' => 'switch1.foo.net', | |
}, | |
{ | |
'certname' => 'switch2', | |
'username' => 'moe', | |
'password' => 'hunter2', | |
'hostname' => 'switch2.foo.net', | |
}, | |
{ | |
'certname' => 'switch3', | |
'username' => 'curly', | |
'password' => 'hunter2', | |
'hostname' => 'switch3.foo.net', | |
}, | |
] | |
file { '/tmp/device.conf': | |
ensure => file, | |
content => epp('device/device.conf.epp'), | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment