Created
June 30, 2017 15:13
-
-
Save WhatsARanjit/94a73f036ef899ad4612bc7a8fb2446a to your computer and use it in GitHub Desktop.
Sharing data by jacking exported resources
This file contains 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
[root@puppet2017 ~]# cat /tmp/test.pp | |
$epptemplate = @(EPP/L) | |
<%- | $nodes | -%> | |
My nodes: | |
<% $nodes.each |$n| { -%> | |
Hostname: <%= $n[0] %> | |
IP: <%= $n[1] %> | |
<% } -%> | |
| EPP | |
notify { 'Data collected': | |
message => inline_epp($epptemplate, { | |
'nodes' => share_data::retrieve('foobar') | |
}), | |
} | |
[root@puppet2017 ~]# puppet apply /tmp/test.pp | |
Notice: Compiled catalog for puppet2017.1.1.puppetlabs.vm in environment production in 0.25 seconds | |
Notice: | |
My nodes: | |
Hostname: node1 | |
IP: 10.0.2.15 | |
Hostname: puppet2017 | |
IP: 10.0.2.15 | |
Notice: /Stage[main]/Main/Notify[Data collected]/message: defined 'message' as ' | |
My nodes: | |
Hostname: node1 | |
IP: 10.0.2.15 | |
Hostname: puppet2017 | |
IP: 10.0.2.15 | |
' | |
Notice: Applied catalog in 0.24 seconds |
This file contains 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
# Put this somewhere in node's classification | |
share_data { $fqdn: | |
data => [ $hostname, $ipaddress ], | |
label => 'foobar', | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Repo: https://github.com/WhatsARanjit/puppet-share_data