Skip to content

Instantly share code, notes, and snippets.

@droopy4096
Last active December 12, 2016 18:31
Show Gist options
  • Save droopy4096/78ba258da54b9fa7dd87d389258fee5c to your computer and use it in GitHub Desktop.
Save droopy4096/78ba258da54b9fa7dd87d389258fee5c to your computer and use it in GitHub Desktop.
# puppet apply --parser=future --trusted_node_data --test --stringify_facts test.pp
Info: Loading facts in /var/lib/puppet/lib/facter/ip6tables_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/apt_reboot_required.rb
Info: Loading facts in /var/lib/puppet/lib/facter/service_provider.rb
Info: Loading facts in /var/lib/puppet/lib/facter/apt_update_last_success.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/apt_updates.rb
Info: Loading facts in /var/lib/puppet/lib/facter/package_provider.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/iptables_persistent_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/iptables_version.rb
Notice: em1,em3,em4,eth0,lo
Notice: eth0
Notice: [eth0]
Notice: Compiled catalog for xx.some.com in environment production in 0.75 seconds
Info: Applying configuration version '1481567209'
Notice: /Stage[main]/Main/File[/tmp/eth0]/ensure: defined content as '{md5}a1a5b3d22e82bbd6f878d26feacc2c7d'
Notice: Finished catalog run in 0.18 seconds
$mac="01:01:01:01:01:01"
$found=[]
notice($facts["interfaces"])
$my_interfaces=split($facts["interfaces"],',')
$mac_interfaces=$my_interfaces.filter | $interface | {
$facts["macaddress_${interface}"] == $mac
}
$mac_interfaces.each | $interface | {
notice($interface)
file {"/tmp/${interface}":
ensure => file,
content => "$interface",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment