Skip to content

Instantly share code, notes, and snippets.

@natemccurdy
Created February 3, 2017 03:56
Show Gist options
  • Save natemccurdy/77c6c5e5275402bb1a1df12bbe1e29db to your computer and use it in GitHub Desktop.
Save natemccurdy/77c6c5e5275402bb1a1df12bbe1e29db to your computer and use it in GitHub Desktop.
Build cisco device.conf with epp, iteration, and magic
#THIS FILE IS MANAGED BY PUPPET
<% $device::data.each | $switch | { -%>
[<%= $switch['certname'] %>]
type cisco
url ssh://<%= $switch['username'] %>:<%= $switch['password'] %>@<%= $switch['hostname'] %>
<% } -%>
$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