from-scratch 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Berksfile.lock +11 -0
- data/chefignore +1 -0
- data/cookbooks/apt/CHANGELOG.md +248 -0
- data/cookbooks/apt/README.md +294 -0
- data/cookbooks/apt/attributes/default.rb +51 -0
- data/cookbooks/apt/files/default/15update-stamp +1 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/libraries/helpers.rb +61 -0
- data/cookbooks/apt/libraries/matchers.rb +17 -0
- data/cookbooks/apt/libraries/network.rb +31 -0
- data/cookbooks/apt/metadata.json +1 -0
- data/cookbooks/apt/providers/preference.rb +84 -0
- data/cookbooks/apt/providers/repository.rb +246 -0
- data/cookbooks/apt/recipes/cacher-client.rb +83 -0
- data/cookbooks/apt/recipes/cacher-ng.rb +43 -0
- data/cookbooks/apt/recipes/default.rb +112 -0
- data/cookbooks/apt/recipes/unattended-upgrades.rb +47 -0
- data/cookbooks/apt/resources/preference.rb +37 -0
- data/cookbooks/apt/resources/repository.rb +60 -0
- data/cookbooks/apt/templates/debian-6.0/acng.conf.erb +173 -0
- data/cookbooks/apt/templates/default/01proxy.erb +9 -0
- data/cookbooks/apt/templates/default/10recommends.erb +3 -0
- data/cookbooks/apt/templates/default/20auto-upgrades.erb +2 -0
- data/cookbooks/apt/templates/default/50unattended-upgrades.erb +68 -0
- data/cookbooks/apt/templates/default/acng.conf.erb +275 -0
- data/cookbooks/apt/templates/default/unattended-upgrades.seed.erb +1 -0
- data/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +269 -0
- data/cookbooks/build-essential/CHANGELOG.md +136 -0
- data/cookbooks/build-essential/README.md +108 -0
- data/cookbooks/build-essential/attributes/default.rb +20 -0
- data/cookbooks/build-essential/libraries/matchers.rb +5 -0
- data/cookbooks/build-essential/libraries/timing.rb +124 -0
- data/cookbooks/build-essential/libraries/xcode_command_line_tools.rb +210 -0
- data/cookbooks/build-essential/metadata.json +1 -0
- data/cookbooks/build-essential/recipes/_debian.rb +28 -0
- data/cookbooks/build-essential/recipes/_fedora.rb +32 -0
- data/cookbooks/build-essential/recipes/_freebsd.rb +24 -0
- data/cookbooks/build-essential/recipes/_mac_os_x.rb +22 -0
- data/cookbooks/build-essential/recipes/_omnios.rb +33 -0
- data/cookbooks/build-essential/recipes/_rhel.rb +36 -0
- data/cookbooks/build-essential/recipes/_smartos.rb +27 -0
- data/cookbooks/build-essential/recipes/_solaris2.rb +48 -0
- data/cookbooks/build-essential/recipes/_suse.rb +29 -0
- data/cookbooks/build-essential/recipes/default.rb +29 -0
- data/cookbooks/chef-sugar/CHANGELOG.md +159 -0
- data/cookbooks/chef-sugar/README.md +464 -0
- data/cookbooks/chef-sugar/metadata.json +1 -0
- data/cookbooks/chef-sugar/recipes/default.rb +34 -0
- data/cookbooks/openssl/CHANGELOG.md +30 -0
- data/cookbooks/openssl/README.md +115 -0
- data/cookbooks/openssl/attributes/default.rb +21 -0
- data/cookbooks/openssl/libraries/secure_password.rb +37 -0
- data/cookbooks/openssl/metadata.json +31 -0
- data/cookbooks/openssl/providers/x509.rb +94 -0
- data/cookbooks/openssl/recipes/default.rb +18 -0
- data/cookbooks/openssl/recipes/upgrade.rb +39 -0
- data/cookbooks/openssl/resources/x509.rb +16 -0
- data/cookbooks/postgresql/CHANGELOG.md +220 -0
- data/cookbooks/postgresql/README.md +464 -0
- data/cookbooks/postgresql/attributes/default.rb +549 -0
- data/cookbooks/postgresql/files/default/tests/minitest/apt_pgdg_postgresql_test.rb +39 -0
- data/cookbooks/postgresql/files/default/tests/minitest/default_test.rb +27 -0
- data/cookbooks/postgresql/files/default/tests/minitest/ruby_test.rb +28 -0
- data/cookbooks/postgresql/files/default/tests/minitest/server_test.rb +43 -0
- data/cookbooks/postgresql/files/default/tests/minitest/support/helpers.rb +29 -0
- data/cookbooks/postgresql/libraries/default.rb +377 -0
- data/cookbooks/postgresql/metadata.json +56 -0
- data/cookbooks/postgresql/recipes/apt_pgdg_postgresql.rb +18 -0
- data/cookbooks/postgresql/recipes/client.rb +32 -0
- data/cookbooks/postgresql/recipes/config_initdb.rb +148 -0
- data/cookbooks/postgresql/recipes/config_pgtune.rb +284 -0
- data/cookbooks/postgresql/recipes/contrib.rb +44 -0
- data/cookbooks/postgresql/recipes/default.rb +18 -0
- data/cookbooks/postgresql/recipes/ruby.rb +117 -0
- data/cookbooks/postgresql/recipes/server.rb +89 -0
- data/cookbooks/postgresql/recipes/server_conf.rb +34 -0
- data/cookbooks/postgresql/recipes/server_debian.rb +38 -0
- data/cookbooks/postgresql/recipes/server_redhat.rb +100 -0
- data/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb +45 -0
- data/cookbooks/postgresql/templates/default/pg_hba.conf.erb +35 -0
- data/cookbooks/postgresql/templates/default/pgsql.sysconfig.erb +4 -0
- data/cookbooks/postgresql/templates/default/postgresql.conf.erb +21 -0
- data/cookbooks/scratchify/.chef/knife.rb +2 -5
- data/cookbooks/scratchify/Berksfile +2 -1
- data/cookbooks/scratchify/Berksfile.lock +11 -0
- data/cookbooks/scratchify/README.md +34 -17
- data/cookbooks/scratchify/bin/scratchify +1 -1
- data/cookbooks/scratchify/chefignore +1 -0
- data/cookbooks/scratchify/from-scratch.gemspec +2 -5
- data/cookbooks/scratchify/lib/from-scratch.rb +25 -0
- data/cookbooks/scratchify/lib/{from/scratch → from-scratch}/version.rb +1 -1
- data/cookbooks/scratchify/metadata.json +2 -1
- data/cookbooks/scratchify/templates/node.json.erb +34 -0
- data/cookbooks/scratchify/templates/user.json.erb +6 -0
- data/lib/from-scratch.rb +2 -2
- data/lib/from-scratch/version.rb +1 -1
- data/templates/node.json.erb +6 -3
- metadata +85 -10
- data/cookbooks/scratchify/bin/console +0 -14
- data/cookbooks/scratchify/bin/setup +0 -7
- data/cookbooks/scratchify/data_bags/users/deploy.json +0 -6
- data/cookbooks/scratchify/environments/.gitkeep +0 -0
- data/cookbooks/scratchify/lib/from/scratch.rb +0 -31
- data/cookbooks/scratchify/lib/from/scratch/interviewer.rb +0 -35
- data/cookbooks/scratchify/nodes/normfood.ru.json +0 -75
- data/cookbooks/scratchify/roles/.gitkeep +0 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Recipe:: cacher-client
|
4
|
+
#
|
5
|
+
# Copyright 2011-2013 Chef Software, Inc.
|
6
|
+
#
|
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
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
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.
|
18
|
+
#
|
19
|
+
|
20
|
+
class ::Chef::Recipe
|
21
|
+
include ::Apt
|
22
|
+
end
|
23
|
+
|
24
|
+
# remove Acquire::http::Proxy lines from /etc/apt/apt.conf since we use 01proxy
|
25
|
+
# these are leftover from preseed installs
|
26
|
+
execute 'Remove proxy from /etc/apt/apt.conf' do
|
27
|
+
command "sed --in-place '/^Acquire::http::Proxy/d' /etc/apt/apt.conf"
|
28
|
+
only_if 'grep Acquire::http::Proxy /etc/apt/apt.conf'
|
29
|
+
end
|
30
|
+
|
31
|
+
servers = []
|
32
|
+
if node['apt']
|
33
|
+
if node['apt']['cacher_ipaddress']
|
34
|
+
cacher = Chef::Node.new
|
35
|
+
cacher.default.name = node['apt']['cacher_ipaddress']
|
36
|
+
cacher.default.ipaddress = node['apt']['cacher_ipaddress']
|
37
|
+
cacher.default.apt.cacher_port = node['apt']['cacher_port']
|
38
|
+
cacher.default.apt.cacher_interface = node['apt']['cacher_interface']
|
39
|
+
cacher.default.apt.cacher_ssl_support = node['apt']['cacher_ssl_support']
|
40
|
+
servers << cacher
|
41
|
+
elsif node['apt']['caching_server']
|
42
|
+
node.override['apt']['compiletime'] = false
|
43
|
+
servers << node
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
unless Chef::Config[:solo] || servers.length > 0
|
48
|
+
query = 'apt_caching_server:true'
|
49
|
+
query += " AND chef_environment:#{node.chef_environment}" if node['apt']['cacher-client']['restrict_environment']
|
50
|
+
Chef::Log.debug("apt::cacher-client searching for '#{query}'")
|
51
|
+
servers += search(:node, query)
|
52
|
+
end
|
53
|
+
|
54
|
+
if servers.length > 0
|
55
|
+
Chef::Log.info("apt-cacher-ng server found on #{servers[0]}.")
|
56
|
+
if servers[0]['apt']['cacher_interface']
|
57
|
+
cacher_ipaddress = interface_ipaddress(servers[0], servers[0]['apt']['cacher_interface'])
|
58
|
+
else
|
59
|
+
cacher_ipaddress = servers[0].ipaddress
|
60
|
+
end
|
61
|
+
t = template '/etc/apt/apt.conf.d/01proxy' do
|
62
|
+
source '01proxy.erb'
|
63
|
+
owner 'root'
|
64
|
+
group 'root'
|
65
|
+
mode 00644
|
66
|
+
variables(
|
67
|
+
proxy: cacher_ipaddress,
|
68
|
+
port: servers[0]['apt']['cacher_port'],
|
69
|
+
proxy_ssl: servers[0]['apt']['cacher_ssl_support'],
|
70
|
+
bypass: node['apt']['cache_bypass']
|
71
|
+
)
|
72
|
+
action(node['apt']['compiletime'] ? :nothing : :create)
|
73
|
+
notifies :run, 'execute[apt-get update]', :immediately
|
74
|
+
end
|
75
|
+
t.run_action(:create) if node['apt']['compiletime']
|
76
|
+
else
|
77
|
+
Chef::Log.info('No apt-cacher-ng server found.')
|
78
|
+
file '/etc/apt/apt.conf.d/01proxy' do
|
79
|
+
action :delete
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
include_recipe 'apt::default'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Recipe:: cacher-ng
|
4
|
+
#
|
5
|
+
# Copyright 2008-2013, Chef Software, Inc.
|
6
|
+
#
|
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
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
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.
|
18
|
+
#
|
19
|
+
|
20
|
+
node.set['apt']['caching_server'] = true
|
21
|
+
|
22
|
+
package 'apt-cacher-ng' do
|
23
|
+
action :install
|
24
|
+
end
|
25
|
+
|
26
|
+
directory node['apt']['cacher_dir'] do
|
27
|
+
owner 'apt-cacher-ng'
|
28
|
+
group 'apt-cacher-ng'
|
29
|
+
mode 0755
|
30
|
+
end
|
31
|
+
|
32
|
+
template '/etc/apt-cacher-ng/acng.conf' do
|
33
|
+
source 'acng.conf.erb'
|
34
|
+
owner 'root'
|
35
|
+
group 'root'
|
36
|
+
mode 00644
|
37
|
+
notifies :restart, 'service[apt-cacher-ng]', :immediately
|
38
|
+
end
|
39
|
+
|
40
|
+
service 'apt-cacher-ng' do
|
41
|
+
supports restart: true, status: false
|
42
|
+
action [:enable, :start]
|
43
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Copyright 2008-2013, Chef Software, Inc.
|
6
|
+
# Copyright 2009, Bryan McLellan <btm@loftninjas.org>
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the 'License');
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an 'AS IS' BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
|
21
|
+
# On systems where apt is not installed, the resources in this recipe are not
|
22
|
+
# executed. However, they _must_ still be present in the resource collection
|
23
|
+
# or other cookbooks which notify these resources will fail on non-apt-enabled
|
24
|
+
# systems.
|
25
|
+
|
26
|
+
Chef::Log.debug 'apt is not installed. Apt-specific resources will not be executed.' unless apt_installed?
|
27
|
+
|
28
|
+
first_run_file = File.join(Chef::Config[:file_cache_path], 'apt_compile_time_update_first_run')
|
29
|
+
|
30
|
+
file '/var/lib/apt/periodic/update-success-stamp' do
|
31
|
+
owner 'root'
|
32
|
+
group 'root'
|
33
|
+
only_if { apt_installed? }
|
34
|
+
action :nothing
|
35
|
+
end
|
36
|
+
|
37
|
+
# If compile_time_update run apt-get update at compile time
|
38
|
+
if node['apt']['compile_time_update'] && (!apt_up_to_date? || !::File.exist?(first_run_file))
|
39
|
+
e = bash 'apt-get-update at compile time' do
|
40
|
+
code <<-EOH
|
41
|
+
apt-get update
|
42
|
+
touch #{first_run_file}
|
43
|
+
EOH
|
44
|
+
ignore_failure true
|
45
|
+
only_if { apt_installed? }
|
46
|
+
action :nothing
|
47
|
+
notifies :touch, 'file[/var/lib/apt/periodic/update-success-stamp]', :immediately
|
48
|
+
end
|
49
|
+
e.run_action(:run)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Updates 'apt-get update' timestamp after each update success
|
53
|
+
directory '/etc/apt/apt.conf.d' do
|
54
|
+
recursive true
|
55
|
+
end
|
56
|
+
|
57
|
+
cookbook_file '/etc/apt/apt.conf.d/15update-stamp' do
|
58
|
+
source '15update-stamp'
|
59
|
+
end
|
60
|
+
|
61
|
+
# For other recipes to call to force an update
|
62
|
+
execute 'apt-get update' do
|
63
|
+
command 'apt-get update'
|
64
|
+
ignore_failure true
|
65
|
+
only_if { apt_installed? }
|
66
|
+
action :nothing
|
67
|
+
notifies :touch, 'file[/var/lib/apt/periodic/update-success-stamp]', :immediately
|
68
|
+
end
|
69
|
+
|
70
|
+
# Automatically remove packages that are no longer needed for dependencies
|
71
|
+
execute 'apt-get autoremove' do
|
72
|
+
command 'apt-get -y autoremove'
|
73
|
+
only_if { apt_installed? }
|
74
|
+
action :nothing
|
75
|
+
end
|
76
|
+
|
77
|
+
# Automatically remove .deb files for packages no longer on your system
|
78
|
+
execute 'apt-get autoclean' do
|
79
|
+
command 'apt-get -y autoclean'
|
80
|
+
only_if { apt_installed? }
|
81
|
+
action :nothing
|
82
|
+
end
|
83
|
+
|
84
|
+
execute 'apt-get-update-periodic' do
|
85
|
+
command 'apt-get update'
|
86
|
+
ignore_failure true
|
87
|
+
only_if { apt_installed? }
|
88
|
+
not_if { apt_up_to_date? }
|
89
|
+
notifies :touch, 'file[/var/lib/apt/periodic/update-success-stamp]', :immediately
|
90
|
+
end
|
91
|
+
|
92
|
+
%w(/var/cache/local /var/cache/local/preseeding).each do |dirname|
|
93
|
+
directory dirname do
|
94
|
+
owner 'root'
|
95
|
+
group 'root'
|
96
|
+
mode 00755
|
97
|
+
action :create
|
98
|
+
only_if { apt_installed? }
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
template '/etc/apt/apt.conf.d/10recommends' do
|
103
|
+
owner 'root'
|
104
|
+
group 'root'
|
105
|
+
mode '644'
|
106
|
+
source '10recommends.erb'
|
107
|
+
end
|
108
|
+
|
109
|
+
package 'apt-transport-https' do
|
110
|
+
only_if { apt_installed? }
|
111
|
+
action :install
|
112
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Recipe:: unattended-upgrades
|
4
|
+
#
|
5
|
+
# Copyright 2014, Chef Software, Inc.
|
6
|
+
#
|
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
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
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.
|
18
|
+
#
|
19
|
+
|
20
|
+
# On systems where apt is not installed, the resources in this recipe are not
|
21
|
+
# executed. However, they _must_ still be present in the resource collection
|
22
|
+
# or other cookbooks which notify these resources will fail on non-apt-enabled
|
23
|
+
# systems.
|
24
|
+
#
|
25
|
+
|
26
|
+
package 'unattended-upgrades' do
|
27
|
+
response_file 'unattended-upgrades.seed.erb'
|
28
|
+
action :install
|
29
|
+
end
|
30
|
+
|
31
|
+
package 'bsd-mailx' do
|
32
|
+
only_if { node['apt']['unattended_upgrades']['mail'] }
|
33
|
+
end
|
34
|
+
|
35
|
+
template '/etc/apt/apt.conf.d/20auto-upgrades' do
|
36
|
+
owner 'root'
|
37
|
+
group 'root'
|
38
|
+
mode '644'
|
39
|
+
source '20auto-upgrades.erb'
|
40
|
+
end
|
41
|
+
|
42
|
+
template '/etc/apt/apt.conf.d/50unattended-upgrades' do
|
43
|
+
owner 'root'
|
44
|
+
group 'root'
|
45
|
+
mode '644'
|
46
|
+
source '50unattended-upgrades.erb'
|
47
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Resource:: preference
|
4
|
+
#
|
5
|
+
# Copyright 2010-2013, Chef Software, Inc.
|
6
|
+
#
|
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
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
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.
|
18
|
+
#
|
19
|
+
|
20
|
+
actions :add, :remove
|
21
|
+
default_action :add if defined?(default_action) # Chef > 10.8
|
22
|
+
|
23
|
+
# Needed for Chef versions < 0.10.10
|
24
|
+
def initialize(*args)
|
25
|
+
super
|
26
|
+
@action = :add
|
27
|
+
end
|
28
|
+
|
29
|
+
state_attrs :glob,
|
30
|
+
:package_name,
|
31
|
+
:pin,
|
32
|
+
:pin_priority
|
33
|
+
|
34
|
+
attribute :package_name, kind_of: String, name_attribute: true, regex: [/^([a-z]|[A-Z]|[0-9]|_|-|\.|\*)+$/]
|
35
|
+
attribute :glob, kind_of: String
|
36
|
+
attribute :pin, kind_of: String
|
37
|
+
attribute :pin_priority, kind_of: String
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Resource:: repository
|
4
|
+
#
|
5
|
+
# Copyright 2010-2013, Chef Software, Inc.
|
6
|
+
#
|
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
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
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.
|
18
|
+
#
|
19
|
+
|
20
|
+
actions :add, :remove
|
21
|
+
default_action :add if defined?(default_action) # Chef > 10.8
|
22
|
+
|
23
|
+
# Needed for Chef versions < 0.10.10
|
24
|
+
def initialize(*args)
|
25
|
+
super
|
26
|
+
@action = :add
|
27
|
+
end
|
28
|
+
|
29
|
+
state_attrs :arch,
|
30
|
+
:cache_rebuild,
|
31
|
+
:components,
|
32
|
+
:cookbook,
|
33
|
+
:deb_src,
|
34
|
+
:distribution,
|
35
|
+
:key,
|
36
|
+
:keyserver,
|
37
|
+
:key_proxy,
|
38
|
+
:repo_name,
|
39
|
+
:trusted,
|
40
|
+
:uri,
|
41
|
+
:sensitive
|
42
|
+
|
43
|
+
# name of the repo, used for source.list filename
|
44
|
+
attribute :repo_name, kind_of: String, name_attribute: true, regex: [/^([a-z]|[A-Z]|[0-9]|_|-|\.)+$/]
|
45
|
+
attribute :uri, kind_of: String
|
46
|
+
attribute :distribution, kind_of: String
|
47
|
+
attribute :components, kind_of: Array, default: []
|
48
|
+
attribute :arch, kind_of: String, default: nil
|
49
|
+
attribute :trusted, kind_of: [TrueClass, FalseClass], default: false
|
50
|
+
# whether or not to add the repository as a source repo as well
|
51
|
+
attribute :deb_src, default: false
|
52
|
+
attribute :keyserver, kind_of: String, default: nil
|
53
|
+
attribute :key, kind_of: String, default: nil
|
54
|
+
attribute :key_proxy, kind_of: String, default: node['apt']['key_proxy']
|
55
|
+
attribute :cookbook, kind_of: String, default: nil
|
56
|
+
# trigger cache rebuild
|
57
|
+
# If not you can trigger in the recipe itself after checking the status of resource.updated{_by_last_action}?
|
58
|
+
attribute :cache_rebuild, kind_of: [TrueClass, FalseClass], default: true
|
59
|
+
# Hide content of the source file, don't show output for commands being run, etc.
|
60
|
+
attribute :sensitive, kind_of: [TrueClass, FalseClass], default: false
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# Letter case in directive names does not matter. Must be separated with colons.
|
2
|
+
# Valid boolean values are a zero number for false, non-zero numbers for true.
|
3
|
+
|
4
|
+
CacheDir: <%= node['apt']['cacher_dir'] %>
|
5
|
+
|
6
|
+
# set empty to disable logging
|
7
|
+
LogDir: /var/log/apt-cacher-ng
|
8
|
+
|
9
|
+
# TCP (http) port
|
10
|
+
# Set to 9999 to emulate apt-proxy
|
11
|
+
Port:<%= node['apt']['cacher_port'] %>
|
12
|
+
|
13
|
+
# Addresses or hostnames to listen on. Multiple addresses must be separated by
|
14
|
+
# spaces. Each entry must be associated with a local interface. DNS resolution
|
15
|
+
# is performed using getaddrinfo(3) for all available protocols (i.e. IPv4 and
|
16
|
+
# IPv6 if available).
|
17
|
+
#
|
18
|
+
# Default: not set, will listen on all interfaces.
|
19
|
+
#
|
20
|
+
# BindAddress: localhost 192.168.7.254 publicNameOnMainInterface
|
21
|
+
|
22
|
+
#Proxy: http://www-proxy.example.net:80
|
23
|
+
#proxy: http://username:proxypassword@proxy.example.net:3128
|
24
|
+
|
25
|
+
# Repository remapping. See manual for details.
|
26
|
+
# In this example, backends file is generated during package installation.
|
27
|
+
Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian
|
28
|
+
Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu
|
29
|
+
Remap-debvol: file:debvol_mirror*.gz /debian-volatile ; file:backends_debvol
|
30
|
+
Remap-cygwin: file:cygwin_mirrors /cygwin # ; file:backends_cygwin # incomplete, please create this file
|
31
|
+
|
32
|
+
# Virtual page accessible in a web browser to see statistics and status
|
33
|
+
# information, i.e. under http://localhost:3142/acng-report.html
|
34
|
+
ReportPage: acng-report.html
|
35
|
+
|
36
|
+
# Socket file for accessing through local UNIX socket instead of TCP/IP. Can be
|
37
|
+
# used with inetd bridge or cron client.
|
38
|
+
# SocketPath:/var/run/apt-cacher-ng/socket
|
39
|
+
|
40
|
+
# Forces log file to be written to disk after every line when set to 1. Default
|
41
|
+
# is 0, buffer flush happens after client disconnects.
|
42
|
+
#
|
43
|
+
# (technically, this is an alias to the Debug option provided for convenience)
|
44
|
+
#
|
45
|
+
# UnbufferLogs: 0
|
46
|
+
|
47
|
+
# Set to 0 to store only type, time and transfer sizes.
|
48
|
+
# 1 -> client IP and relative local path are logged too
|
49
|
+
# VerboseLog: 1
|
50
|
+
|
51
|
+
# Don't detach from the console
|
52
|
+
# ForeGround: 0
|
53
|
+
|
54
|
+
# Store the pid of the daemon process therein
|
55
|
+
# PidFile: /var/run/apt-cacher-ng/pid
|
56
|
+
|
57
|
+
# Forbid outgoing connections, work around them or respond with 503 error
|
58
|
+
# offlinemode:0
|
59
|
+
|
60
|
+
# Forbid all downloads that don't run through preconfigured backends (.where)
|
61
|
+
#ForceManaged: 0
|
62
|
+
|
63
|
+
# Days before considering an unreferenced file expired (to be deleted).
|
64
|
+
# Warning: if the value is set too low and particular index files are not
|
65
|
+
# available for some days (mirror downtime) there is a risk of deletion of
|
66
|
+
# still usefull package files.
|
67
|
+
ExTreshold: 4
|
68
|
+
|
69
|
+
# Stop expiration when a critical problem appeared. Currently only failed
|
70
|
+
# refresh of an index file is considered as critical.
|
71
|
+
#
|
72
|
+
# WARNING: don't touch this option or set to a non-zero number.
|
73
|
+
# Anything else is DANGEROUS and may cause data loss.
|
74
|
+
#
|
75
|
+
# ExAbortOnProblems: 1
|
76
|
+
|
77
|
+
# Replace some Windows/DOS-FS incompatible chars when storing
|
78
|
+
# StupidFs: 0
|
79
|
+
|
80
|
+
# Experimental feature for apt-listbugs: pass-through SOAP requests and
|
81
|
+
# responses to/from bugs.debian.org. If not set, default is true if
|
82
|
+
# ForceManaged is enabled and false otherwise.
|
83
|
+
# ForwardBtsSoap: 1
|
84
|
+
|
85
|
+
# The daemon has a small cache for DNS data, to speed up resolution. The
|
86
|
+
# expiration time of the DNS entries can be configured in seconds.
|
87
|
+
# DnsCacheSeconds: 3600
|
88
|
+
|
89
|
+
# Don't touch the following values without good consideration!
|
90
|
+
#
|
91
|
+
# Max. count of connection threads kept ready (for faster response in the
|
92
|
+
# future). Should be a sane value between 0 and average number of connections,
|
93
|
+
# and depend on the amount of spare RAM.
|
94
|
+
# MaxStandbyConThreads: 8
|
95
|
+
#
|
96
|
+
# Hard limit of active thread count for incomming connections, i.e. operation
|
97
|
+
# is refused when this value is reached (below zero = unlimited).
|
98
|
+
# MaxConThreads: -1
|
99
|
+
#
|
100
|
+
#VfilePattern = (^|.*?/)(Index|Packages\.bz2|Packages\.gz|Packages|Release|Release\.gpg|Sources\.bz2|Sources\.gz|Sources|release|index\.db-.*\.gz|Contents-[^/]*\.gz|pkglist[^/]*\.bz2|rclist[^/]*\.bz2|/meta-release[^/]*|Translation[^/]*\.bz2)$
|
101
|
+
#PfilePattern = .*(\.deb|\.rpm|\.dsc|\.tar\.gz\.gpg|\.tar\.gz|\.diff\.gz|\.diff\.bz2|\.jigdo|\.template|changelog|copyright|\.udeb|\.diff/.*\.gz|vmlinuz|initrd\.gz|(Devel)?ReleaseAnnouncement(\\?.*)?)$
|
102
|
+
# Whitelist for expiration, file types not to be removed even when being
|
103
|
+
# unreferenced. Default: same as VfilePattern which is a safe bed. When and
|
104
|
+
# only when the only used mirrors are official repositories (with working
|
105
|
+
# Release files) then it might be set to something more restrictive, like
|
106
|
+
# (^|.*?/)(Release|Release\.gpg|release|meta-release|Translation[^/]*\.bz2)$
|
107
|
+
#WfilePattern = (^|.*?/)(Index|Packages\.bz2|Packages\.gz|Packages|Release|Release\.gpg|Sources\.bz2|Sources\.gz|Sources|release|index\.db-.*\.gz|Contents-[^/]*\.gz|pkglist[^/]*\.bz2|rclist[^/]*\.bz2|/meta-release[^/]*|Translation[^/]*\.bz2)$
|
108
|
+
|
109
|
+
# Higher modes only working with the debug version
|
110
|
+
# Warning, writes a lot into apt-cacher.err logfile
|
111
|
+
# Value overwrites UnbufferLogs setting (aliased)
|
112
|
+
# Debug:3
|
113
|
+
|
114
|
+
# Usually, general purpose proxies like Squid expose the IP adress of the
|
115
|
+
# client user to the remote server using the X-Forwarded-For HTTP header. This
|
116
|
+
# behaviour can be optionally turned on with the Expose-Origin option.
|
117
|
+
# ExposeOrigin: 0
|
118
|
+
|
119
|
+
# When logging the originating IP address, trust the information supplied by
|
120
|
+
# the client in the X-Forwarded-For header.
|
121
|
+
# LogSubmittedOrigin: 0
|
122
|
+
|
123
|
+
# The version string reported to the peer, to be displayed as HTTP client (and
|
124
|
+
# version) in the logs of the mirror.
|
125
|
+
# WARNING: some archives use this header to detect/guess capabilities of the
|
126
|
+
# client (i.e. redirection support) and change the behaviour accordingly, while
|
127
|
+
# ACNG might not support the expected features. Expect side effects.
|
128
|
+
#
|
129
|
+
# UserAgent: Yet Another HTTP Client/1.2.3p4
|
130
|
+
|
131
|
+
# In some cases the Import and Expiration tasks might create fresh volatile
|
132
|
+
# data for internal use by reconstructing them using patch files. This
|
133
|
+
# by-product might be recompressed with bzip2 and with some luck the resulting
|
134
|
+
# file becomes identical to the *.bz2 file on the server, usable for APT
|
135
|
+
# clients trying to fetch the full .bz2 compressed version. Injection of the
|
136
|
+
# generated files into the cache has however a disadvantage on underpowered
|
137
|
+
# servers: bzip2 compession can create high load on the server system and the
|
138
|
+
# visible download of the busy .bz2 files also becomes slower.
|
139
|
+
#
|
140
|
+
# RecompBz2: 0
|
141
|
+
|
142
|
+
# Network timeout for outgoing connections.
|
143
|
+
# NetworkTimeout: 60
|
144
|
+
|
145
|
+
# Sometimes it makes sense to not store the data in cache and just return the
|
146
|
+
# package data to client as it comes in. DontCache parameters can enable this
|
147
|
+
# behaviour for certain URL types. The tokens are extended regular expressions
|
148
|
+
# that URLs are matched against.
|
149
|
+
#
|
150
|
+
# DontCacheRequested is applied to the URL as it comes in from the client.
|
151
|
+
# Example: exclude packages built with kernel-package for x86
|
152
|
+
# DontCacheRequested: linux-.*_10\...\.Custo._i386
|
153
|
+
# Example usecase: exclude popular private IP ranges from caching
|
154
|
+
# DontCacheRequested: 192.168.0 ^10\..* 172.30
|
155
|
+
#
|
156
|
+
# DontCacheResolved is applied to URLs after mapping to the target server. If
|
157
|
+
# multiple backend servers are specified then it's only matched against the
|
158
|
+
# download link for the FIRST possible source (due to implementation limits).
|
159
|
+
# Example usecase: all Ubuntu stuff comes from a local mirror (specified as
|
160
|
+
# backend), don't cache it again:
|
161
|
+
# DontCacheResolved: ubuntumirror.local.net
|
162
|
+
#
|
163
|
+
# DontCache directive sets (overrides) both, DontCacheResolved and
|
164
|
+
# DontCacheRequested. Provided for convenience, see those directives for
|
165
|
+
# details.
|
166
|
+
#
|
167
|
+
# Default permission set of freshly created files and directories, as octal
|
168
|
+
# numbers (see chmod(1) for details).
|
169
|
+
# Can by limited by the umask value (see umask(2) for details) if it's set in
|
170
|
+
# the environment of the starting shell, e.g. in apt-cacher-ng init script or
|
171
|
+
# in its configuration file.
|
172
|
+
# DirPerms: 00755
|
173
|
+
# FilePerms: 00664
|