From 9b4756441a2c344a85574c589f7c99d508a96700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Fri, 22 Jan 2021 18:33:58 +0100 Subject: [PATCH] Add a recipe to join the private Zerotier network --- site-cookbooks/kosmos_zerotier/recipes/default.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/site-cookbooks/kosmos_zerotier/recipes/default.rb b/site-cookbooks/kosmos_zerotier/recipes/default.rb index 12c2304..7e47d0f 100644 --- a/site-cookbooks/kosmos_zerotier/recipes/default.rb +++ b/site-cookbooks/kosmos_zerotier/recipes/default.rb @@ -2,3 +2,15 @@ # Cookbook:: kosmos_zerotier # Recipe:: default # + +zerotier_controller = search(:node, "role:zerotier_controller").first + +controller_url = "http://#{zerotier_controller["knife_zero"]["host"]}:#{node['kosmos_zerotier']['server_port']}" + +credentials = data_bag_item("credentials", "zerotier") + +zerotier_network credentials["network_id"] do + node_name node['fqdn'] + auth_token credentials["auth_token"] + central_url controller_url +end