This repository has been archived by the owner on Oct 16, 2024. It is now read-only.
forked from criteo-cookbooks/chef-exabgp
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdefault.rb
49 lines (42 loc) · 1.55 KB
/
default.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# Cookbook Name:: exabgp
# Recipe:: default
#
# Copyright 2012, DNSimple, Inc.
#
# 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.
#
include_recipe 'python'
include_recipe 'runit'
python_pip 'exabgp' do
action :install
end unless node[:recipes].include? 'exabgp::source'
directory '/etc/exabgp'
template 'exabgp: config' do
path '/etc/exabgp/exabgp.conf'
source 'exabgp.conf.erb'
variables( router_id: node.ipaddress,
hold_time: node[:exabgp][:hold_time],
neighbor_ipv4: node[:exabgp][:ipv4][:neighbor],
local_address_ipv4: node.ipaddress,
route_ipv4: node[:exabgp][:ipv4][:anycast].gsub(/\d+$/, '0'),
neighbor_ipv6: node[:exabgp][:ipv6][:neighbor],
local_address_ipv6: node[:ipv6address],
route_ipv6: node[:exabgp][:ipv6][:anycast].gsub(/\d+$/, ''),
local_as: node[:exabgp][:local_as],
peer_as: node[:exabgp][:peer_as],
community: node[:exabgp][:community].join(' '))
mode '644'
notifies :restart, 'service[exabgp]'
end
runit_service 'exabgp'