065eac06b1
The attributes are saved as "automatic" attributes and look like this:
"zerotier": {
"version": "1.16.2",
"node_id": "NODEID",
"networks": {
"NETWORKID": {
"network_name": "networkname",
"mac": "ff:ff:ff:ff:ff:ff",
"status": "OK",
"type": "PRIVATE",
"interface": "abcdefg",
"addresses": [
"10.1.1.255/24"
]
}
}
}
Refs #263
22 lines
436 B
Ruby
22 lines
436 B
Ruby
#
|
|
# Cookbook:: kosmos_zerotier
|
|
# Recipe:: ohai_plugin
|
|
#
|
|
|
|
include_recipe "zerotier::ohai_plugin"
|
|
|
|
ohai "reload_zerotier" do
|
|
action :reload
|
|
plugin "zerotier"
|
|
notifies :run, "ruby_block[save_chef_zero_node]", :delayed
|
|
end
|
|
|
|
# Force save the node back to disk in Chef Zero
|
|
ruby_block "save_chef_zero_node" do
|
|
block do
|
|
node.save
|
|
Chef::Log.info("Node #{node.name} saved to disk with ZeroTier data")
|
|
end
|
|
action :nothing
|
|
end
|