Git Product home page Git Product logo

chef-zerotier's Introduction

ZeroTier Cookbook

This is a Chef cookbook to manage ZeroTier networks on your Chef nodes.

Supported Platforms

  • Debian
  • Ubuntu
  • CentOS
  • RHEL
  • Amazon

Recipes

zerotier::default

Default recipe. Calls zerotier::install

zerotier::install

Install's ZeroTier One on your system via the native package management system.

zerotier::ohai_plugin

Installs the Ohai plugin for ZeroTier. This is required by the provided LWRP zerotier_network.

zerotier::join_networks

Shortcut to automatically join networks stored in attributes (See example in the Attributes section below)

Attributes

node['zerotier']['install_version']

Version of ZeroTier to install. Empty by default and defaults to the latest version available.

node['zerotier']['central_url']

URL to the instance of the ZeroTier Central controller. Defaults to https://my.zerotier.com. Will be useful in the future when Central is distributable to our enterprise customers.

node['zerotier']['public_autojoin']

List of public networks to automatically join when using the zerotier::join_networks recipe. These networks do not require any interaction with the network controller.

node['zerotier']['private_autojoin']

List of private networks to automatically join when using the zerotier::join_networks recipe. Joining a private network requires an API Access Token generated at https://my.zerotier.com. Each member of the list is a hash as follows:

{
	:network_id => "your_network_id",
    :auth_token => "your_auth_token",  # API access token generated at https://my.zerotier.com
    :central_url => "URL_to_central_instance" # Not required.  Defaults to https://my.zerotier.com
}

LWRP

The ZeroTier recpie provides the zerotier_network lwrp

Attributes:

  • network_id - Network ID to join. defaults to the name attribute.
  • node_name - Name of the node to put in https://my.zerotier.com (only applicable when joining a private network)
  • auth_token - API access token generated in your account at https://my.zerotier.com. Required if you wish to automatically authorize the node to join the network.
  • central_url - URL to the instance of ZeroTier Central. Defaults to https://my.zerotier.com.
  • action - :join or :leave. Defaults to :join

chef-zerotier's People

Contributors

glimberg avatar russellseymour avatar someara avatar tas50 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

chef-zerotier's Issues

Cannot join network with resource

I am trying to connect to a network using the resource, however the following:

zerotier_network node["common"]["zerotier"]["networkid"] do
  node_name node["hostname"]
  auth_token node["common"]["zerotier"]["authtoken"]
end

Produces the following error:

  * zerotier_network[xxxxxxxxx] action join

    ================================================================================
    Error executing action `join` on resource 'zerotier_network[xxxxxxxxx]'
    ================================================================================

    NameError
    ---------
    uninitialized constant Chef::Resource::ZerotierNetwork

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/zerotier/providers/network.rb:11:in `load_current_resource'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/common/recipes/zerotier.rb

      7: zerotier_network node["common"]["zerotier"]["networkid"] do
      8:   node_name node["hostname"]
      9:   auth_token node["common"]["zerotier"]["authtoken"]
     10: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/common/recipes/zerotier.rb:7:in `from_file'

    zerotier_network("xxxxxxxxx") do
      action [:join]
      default_guard_interpreter :default
      declared_type :zerotier_network
      cookbook_name "common"
      recipe_name "zerotier"
      node_name "xxxxx-xxxx-02"
      auth_token "xxxxxxxxxxxxxxxxxxxxxx"
    end

    System Info:
    ------------
    chef_version=13.2.20
    platform=ubuntu
    platform_version=16.04
    ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
    program_name=chef-client worker: ppid=2689;start=11:43:49;
    executable=/opt/chef/bin/chef-client

I am pretty sure this is down to the way in which resources should be written now. I have started working on a fork of this, however I do not know what the attribute in this line is https://github.com/russellseymour/chef-zerotier/blob/master/providers/network.rb#L32.

There are no notes for node["zerotier"]["node_id"]. Is this a typo and should be the node name?

Auto Authorization does not work

Chef Log:

  * ohai_plugin[zerotier_ohai] action create
    * directory[/etc/chef/ohai/plugins] action create (skipped due to not_if)
    * template[/etc/chef/ohai/plugins/zerotier_ohai.rb] action create (up to date)
    * ohai[zerotier_ohai] action nothing (skipped due to action :nothing)
     (up to date)
Recipe: zerotier::join_networks
  * zerotier_network[XXXXXXXXXXXXXXX] action join (up to date)

Running handlers:
Running handlers complete
Chef Client finished, 2/14 resources updated in 05 seconds
root@masterchef:~/chef-repo/cookbooks# zerotier-cli listnetworks
200 listnetworks <nwid> <name> <mac> <status> <type> <dev> <ZT assigned ips>
200 listnetworks XXXXXXXXXXXXXXX  AA:BB:CC:DD:EE:FF ACCESS_DENIED PRIVATE ztbpaj2l7d -

I dont know how to debug the LWRP, but i cant rebuild that Request and there i get this error

{"type":"internal","message":"Error marshalling json"}

But even if do a Request with the complete Payload (getting it with GET Request before), not just the small Part, replace the "authorized: false" with true, it just does not authorize the Node.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.