This message was deleted.
# puppet
s
This message was deleted.
y
Your erb will be compiled into a file contents in a catalog on a puppetserver.. I guess you’d like to have the info from an agent, right? :)
If you’re adventurous and want to confuse your colleagues you may try to play around Deferred to render the erb on an agent side.. but it’s not that obvious
y
The
Do something
part includes looking up fact information - the expected output format is something like this:
Copy code
VLAN|INTERFACE|U/T
2|missing|
3|missing|
25|em1|untagged
26|em1|tagged
27|em2|tagged
100|em2|tagged
y
I’d go with facts.. or maybe generate the bash right on a node with a ruby script called from a puppet with Exec
y
I was afraid of that... I already created a script in my Gem (
exe/get_network_list
) to output that:
Copy code
#!/usr/bin/env ruby
# frozen_string_literal: true

require "my_network/vlan_table"

MyNetwork::VlanTable::VLANS.each do |net|

  vlan_id = net[:vlan]
  subnet = net[:subnet]

  puts "%s|%s/%s" % [vlan_id, subnet, subnet.prefix() ]

end
which can be executed as
/opt/puppetlabs/puppet/bin/get_network_list
y
Looks good but I’d put it under /usr/local/bin instead to not pollute the /opt/puppetlabs
y
gem puts it there automatically