5 # Copyright:: 2010, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # https://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 cache_dir = Chef::Config[:file_cache_path]
22 cinc_version = node[:chef][:client][:version]
24 cinc_platform = if platform?("debian")
36 os_release = node[:lsb][:release]
38 cinc_package = "cinc_#{cinc_version}-1_#{cinc_arch}.deb"
40 Dir.glob("#{cache_dir}/cinc_*.deb").each do |deb|
41 next if deb == "#{cache_dir}/#{cinc_package}"
49 remote_file "#{cache_dir}/#{cinc_package}" do
50 source "https://downloads.cinc.sh/files/stable/cinc/#{cinc_version}/#{cinc_platform}/#{os_release}/#{cinc_package}"
58 dpkg_package "cinc" do
59 source "#{cache_dir}/#{cinc_package}"
60 version "#{cinc_version}-1"
63 directory "/etc/cinc" do
69 template "/etc/cinc/client.rb" do
70 source "client.rb.erb"
76 file "/etc/cinc/client.pem" do
82 template "/etc/cinc/report.rb" do
83 source "report.rb.erb"
91 template "/etc/logrotate.d/cinc" do
92 source "logrotate.erb"
98 directory "/var/log/cinc" do
104 systemd_service "cinc-client" do
105 description "Cinc client"
106 exec_start "/usr/bin/cinc-client"
110 systemd_timer "cinc-client" do
111 description "Cinc client"
112 after "network.target"
114 on_unit_inactive_sec 25 * 60
115 randomized_delay_sec 10 * 60
118 service "cinc-client.timer" do
119 action [:enable, :start]