diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..8fe1742 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,26 @@ +AllCops: + Exclude: + - vendor/**/* + - ruby/**/* + - test/**/* + - files/**/* + - .kitchen/**/* + +AlignParameters: + Enabled: false +Encoding: + Enabled: false +UselessAssignment: + Enabled: false +LineLength: + Max: 300 +MethodLength: + Max: 11 +HashSyntax: + EnforcedStyle: hash_rockets +IfUnlessModifier: + Enabled: false +TrivialAccessors: + ExactNameMatch: true +Style/RegexpLiteral: + Enabled: false diff --git a/README.md b/README.md index 1c8bc20..e6adb0a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,34 @@ -# chef-vxfld -vxfld (https://github.com/CumulusNetworks/vxfld) cookbook for chef +Description +=========== + +This cookbook installs the Cumulus VXLAN BUM flooding suite. + +Requirements +============ + +Chef 11 or higher required (for Chef environment use). + +Platforms +-------- + +* Ubuntu + +License and Author +================== + +Author:: David Wahlstrom () +Author:: Jordan Tardif () + +Copyright 2015 Dreamhost, LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/attributes/vxrd.rb b/attributes/vxrd.rb new file mode 100644 index 0000000..799fc27 --- /dev/null +++ b/attributes/vxrd.rb @@ -0,0 +1,3 @@ +default['vxfld']['vxrd']['packages'] = ['vxfld'] +default['vxfld']['vxrd']['svcnode_ip'] = '' +default['vxfld']['vxrd']['src_ip'] = node['ipaddress'] diff --git a/attributes/vxsnd.rb b/attributes/vxsnd.rb new file mode 100644 index 0000000..0e4b25b --- /dev/null +++ b/attributes/vxsnd.rb @@ -0,0 +1,3 @@ +default['vxfld']['vxsnd']['packages'] = ['vxfld'] +default['vxfld']['vxsnd']['src_ip'] = node['ipaddress'] +default['vxfld']['vxsnd']['peers'] = '' diff --git a/metadata.rb b/metadata.rb new file mode 100644 index 0000000..d2e997d --- /dev/null +++ b/metadata.rb @@ -0,0 +1,18 @@ +name 'vxfld' +maintainer 'DreamHost' +maintainer_email 'david.wahlstrom@dreamhost.com' +license 'Apache 2.0' +description 'Cumulus\'s VXLAN BUM flooding suite.' +long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +version '0.1.8' + +recipe 'vxsnd', '' +recipe 'vxrd', '' + +%w( ubuntu debian ).each do |os| + supports os +end + +%w( apt ).each do |dep| + depends dep +end diff --git a/recipes/default.rb b/recipes/default.rb new file mode 100644 index 0000000..6447d9a --- /dev/null +++ b/recipes/default.rb @@ -0,0 +1,18 @@ +# +# Cookbook Name:: vxfld +# Recipe:: default +# +# Copyright 2015, Dreamhost LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/recipes/vxrd.rb b/recipes/vxrd.rb new file mode 100644 index 0000000..cdd77de --- /dev/null +++ b/recipes/vxrd.rb @@ -0,0 +1,54 @@ +# +# Cookbook Name:: vxfld +# Recipe:: vxrd +# +# Copyright 2015, Dreamhost LLC +# +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +node['vxfld']['vxrd']['packages'].each do |p| + package p do + action :upgrade + end +end + +# logs may not go here based on logdest configuration, but at least +# we'll have a directory in place to catch the default configuration +# and follow a relatively normal logging file structure +directory '/var/log/vxfld' do + action :create + owner 'root' + group 'root' + mode '0755' +end + +template '/etc/vxrd.conf' do + source 'vxrd.conf.erb' + owner 'root' + group 'root' + mode '0644' +end + +file '/etc/default/vxrd' do + content 'START=yes' +end + +service 'vxrd' do + supports :status => true, :restart => true + action :enable + subscribes :restart, resources(:template => '/etc/vxrd.conf'), :delayed + node['vxfld']['vxrd']['packages'].each do |p| + subscribes :restart, resources(:package => p), :delayed + end +end diff --git a/recipes/vxsnd.rb b/recipes/vxsnd.rb new file mode 100644 index 0000000..175d8cd --- /dev/null +++ b/recipes/vxsnd.rb @@ -0,0 +1,58 @@ +# +# Cookbook Name:: vxfld +# Recipe:: vxsnd +# +# Copyright 2015, Dreamhost LLC +# +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +node['vxfld']['vxsnd']['packages'].each do |p| + package p do + action :upgrade + end +end + +package node['vxfld']['vxsnd']['packages'] do + action :upgrade +end + +# logs may not go here based on logdest configuration, but at least +# we'll have a directory in place to catch the default configuration +# and follow a relatively normal logging file structure +directory '/var/log/vxfld' do + action :create + owner 'root' + group 'root' + mode '0755' +end + +template '/etc/vxsnd.conf' do + source 'vxsnd.conf.erb' + owner 'root' + group 'root' + mode '0644' +end + +file '/etc/default/vxsnd' do + content 'START=yes' +end + +service 'vxsnd' do + supports :status => true, :restart => true + action :enable + subscribes :restart, resources(:template => '/etc/vxsnd.conf'), :delayed + node['vxfld']['vxsnd']['packages'].each do |p| + subscribes :restart, resources(:package => p), :delayed + end +end diff --git a/templates/default/vxrd.conf.erb b/templates/default/vxrd.conf.erb new file mode 100644 index 0000000..db1b658 --- /dev/null +++ b/templates/default/vxrd.conf.erb @@ -0,0 +1,46 @@ +[common] +# Log level is one of DEBUG, INFO, WARNING, ERROR, CRITICAL +loglevel = DEBUG + +# Destination for log message. Can be a file name, 'stdout', or 'syslog' +logdest = stdout + +# log file size in bytes. Used when logdest is a file +#logfilesize = 512000 + +# maximum number of log files stored on disk. Used when logdest is a file +#logbackupcount = 14 + +# The file to write the pid. If using monit, this must match the one +# in the vxrd.rc +#pidfile = /var/run/vxrd.pid + +# The file name for the unix domain socket used for mgmt. +#udsfile = /var/run/vxrd.sock + +# UDP port for vxfld control messages +#vxfld_port = 10001 + +# This is the address to which a vxrd sends control messages for registration +svcnode_ip = <%= node['vxfld']['vxrd']['svcnode_ip'] %> + +# Holdtime (in seconds) for soft state. It's how long the service node waits +# before ageing out an IP address for a VNI. vxrd includes this in the register +# msgs it sends to a vxsnd +#holdtime = 90 + +# Local IP address to bind to for receiving control traffic from the snd +src_ip = <%= node["vxfld"]["vxrd"]["src_ip"] %> + +[vxrd] +# Number of times to refresh within the hold time. The higher this number +# the more lost UDP refresh messages can be tolerated +#refresh_rate = 3 + +# Seconds to poll the system for current VXLAN membership +#config_check_rate = 5 + +# Enable self replication +# Note: Use true, or on, for True and 0, no, false, or off, +# for False +head_rep = false diff --git a/templates/default/vxsnd.conf.erb b/templates/default/vxsnd.conf.erb new file mode 100644 index 0000000..10fd4c7 --- /dev/null +++ b/templates/default/vxsnd.conf.erb @@ -0,0 +1,58 @@ +[common] +# Log level is one of DEBUG, INFO, WARNING, ERROR, CRITICAL +loglevel = DEBUG + +# Destination for log message. Can be a file name, 'stdout', or 'syslog' +logdest = stdout + +# log file size in bytes. Used when logdest is a file +#logfilesize = 512000 + +# maximum number of log files stored on disk. Used when logdest is a file +#logbackupcount = 14 + +# The file to write the pid. If using monit, this must match the one +# in the vxsnd.rc +#pidfile = /var/run/vxsnd.pid + +# The file name for the unix domain socket used for mgmt. +#udsfile = /var/run/vxsnd.sock + +# UDP port for vxfld control messages +#vxfld_port = 10001 + +# This is the address to which registration daemons send control messages for +# registration and/or BUM packets for replication +#svcnode_ip = 0.0.0.0 + +# Holdtime (in seconds) for soft state. It is used when sending a +# register msg to peers in response to learning a from a +# VXLAN data pkt +#holdtime = 90 + +# Local IP address to bind to for receiving inter-vxsnd control traffic +src_ip = <%= node["vxfld"]["vxsnd"]["src_ip"] %> + +[vxsnd] +# Space separated list of IP addresses of vxsnd to share state with +svcnode_peers = <%= node["vxfld"]["vxsnd"]["peers"] %> + +# When set to true, the service node will listen for vxlan data traffic +# Note: Use 1, yes, true, or on, for True and 0, no, false, or off, +# for False +enable_vxlan_listen = true + +# When set to true, the svcnode_ip will be installed on the loopback +# interface, and it will be withdrawn when the vxsnd is no longer in +# service. If set to true, the svcnode_ip configuration +# variable must be defined. +# Note: Use 1, yes, true, or on, for True and 0, no, false, or off, +# for False +#install_svcnode_ip = false + +# Seconds to wait before checking the database to age out stale entries +#age_check = 90 +# + +vxlan_listen_port = 4789 +vxlan_dest_port = 4789