vagrant-clone 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/.rakeTasks +7 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/runConfigurations/clone.xml +21 -0
- data/.idea/runConfigurations/libvirt.xml +21 -0
- data/.idea/vagrant-clone.iml +114 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +948 -0
- data/Gemfile +9 -3
- data/Gemfile.lock +123 -37
- data/Rakefile +2 -1
- data/Vagrantfile +9 -0
- data/cookbooks/apt/CHANGELOG.md +321 -0
- data/cookbooks/apt/CONTRIBUTING.md +2 -0
- data/cookbooks/apt/MAINTAINERS.md +15 -0
- data/cookbooks/apt/README.md +250 -0
- data/cookbooks/apt/attributes/default.rb +57 -0
- data/cookbooks/apt/files/15update-stamp +1 -0
- data/cookbooks/apt/files/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/libraries/helpers.rb +49 -0
- data/cookbooks/apt/libraries/matchers.rb +16 -0
- data/cookbooks/apt/metadata.json +1 -0
- data/cookbooks/apt/recipes/cacher-client.rb +52 -0
- data/cookbooks/apt/recipes/cacher-ng.rb +39 -0
- data/cookbooks/apt/recipes/default.rb +93 -0
- data/cookbooks/apt/recipes/unattended-upgrades.rb +47 -0
- data/cookbooks/apt/resources/preference.rb +90 -0
- data/cookbooks/apt/templates/01proxy.erb +11 -0
- data/cookbooks/apt/templates/10dpkg-options.erb +8 -0
- data/cookbooks/apt/templates/10recommends.erb +3 -0
- data/cookbooks/apt/templates/20auto-upgrades.erb +5 -0
- data/cookbooks/apt/templates/50unattended-upgrades.erb +75 -0
- data/cookbooks/apt/templates/acng.conf.erb +275 -0
- data/cookbooks/apt/templates/unattended-upgrades.seed.erb +1 -0
- data/cookbooks/build-essential/.foodcritic +1 -0
- data/cookbooks/build-essential/CHANGELOG.md +257 -0
- data/cookbooks/build-essential/CONTRIBUTING.md +2 -0
- data/cookbooks/build-essential/MAINTAINERS.md +15 -0
- data/cookbooks/build-essential/README.md +134 -0
- data/cookbooks/build-essential/attributes/default.rb +21 -0
- data/cookbooks/build-essential/libraries/matchers.rb +9 -0
- data/cookbooks/build-essential/metadata.json +1 -0
- data/cookbooks/build-essential/recipes/_windows.rb +53 -0
- data/cookbooks/build-essential/recipes/default.rb +24 -0
- data/cookbooks/build-essential/resources/build_essential.rb +106 -0
- data/cookbooks/build-essential/resources/xcode_command_line_tools.rb +61 -0
- data/cookbooks/compat_resource/CHANGELOG.md +53 -0
- data/cookbooks/compat_resource/CONTRIBUTING.md +2 -0
- data/cookbooks/compat_resource/MAINTAINERS.md +16 -0
- data/cookbooks/compat_resource/README.md +60 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/constants.rb +47 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb +40 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/core.rb +73 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb +315 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/platform_introspection.rb +292 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb +37 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/universal.rb +70 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/lazy_module_include.rb +98 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/notifying_block.rb +74 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/params_validate.rb +510 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/powershell_out.rb +117 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/properties.rb +328 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/property.rb +713 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/apt_repository.rb +269 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/apt_update.rb +105 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/noop.rb +56 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/support/yum_repo.erb +132 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/systemd_unit.rb +253 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/yum_repository.rb +136 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb +164 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/action_class.rb +114 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_repository.rb +65 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_update.rb +52 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/systemd_unit.rb +81 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/yum_repository.rb +97 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource.rb +214 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb +174 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef.rb +29 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/mixin/properties.rb +8 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/exceptions.rb +10 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/log.rb +30 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/mixin/params_validate.rb +17 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/node.rb +9 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/property.rb +15 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/provider.rb +65 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe.rb +118 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe_hook.rb +20 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb +60 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource.rb +156 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb +167 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_list.rb +49 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_set.rb +49 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection.rb +103 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb +691 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb +153 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb +33 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches.rb +41 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/property.rb +6 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/recipe.rb +8 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/resource/lwrp_base.rb +44 -0
- data/cookbooks/compat_resource/files/lib/chef_compat/resource.rb +56 -0
- data/cookbooks/compat_resource/files/lib/chef_upstream_version.rb +3 -0
- data/cookbooks/compat_resource/files/lib/compat_resource.rb +35 -0
- data/cookbooks/compat_resource/libraries/autoload.rb +31 -0
- data/cookbooks/compat_resource/metadata.json +1 -0
- data/cookbooks/inifile_chef_gem/CHANGELOG.md +11 -0
- data/cookbooks/inifile_chef_gem/README.md +46 -0
- data/cookbooks/inifile_chef_gem/metadata.json +51 -0
- data/cookbooks/inifile_chef_gem/metadata.rb +11 -0
- data/cookbooks/inifile_chef_gem/resources/default.rb +28 -0
- data/cookbooks/mariadb/CHANGELOG.md +332 -0
- data/cookbooks/mariadb/README.md +225 -0
- data/cookbooks/mariadb/attributes/default.rb +199 -0
- data/cookbooks/mariadb/libraries/mariadb_conn_helper.rb +53 -0
- data/cookbooks/mariadb/libraries/mariadb_helper.rb +216 -0
- data/cookbooks/mariadb/libraries/matchers.rb +21 -0
- data/cookbooks/mariadb/metadata.json +1 -0
- data/cookbooks/mariadb/providers/configuration.rb +39 -0
- data/cookbooks/mariadb/recipes/_audit_plugin.rb +63 -0
- data/cookbooks/mariadb/recipes/_debian_galera.rb +62 -0
- data/cookbooks/mariadb/recipes/_debian_server.rb +78 -0
- data/cookbooks/mariadb/recipes/_mariadb_repository.rb +29 -0
- data/cookbooks/mariadb/recipes/_redhat_client.rb +27 -0
- data/cookbooks/mariadb/recipes/_redhat_galera.rb +55 -0
- data/cookbooks/mariadb/recipes/_redhat_server.rb +58 -0
- data/cookbooks/mariadb/recipes/client.rb +47 -0
- data/cookbooks/mariadb/recipes/config.rb +115 -0
- data/cookbooks/mariadb/recipes/default.rb +46 -0
- data/cookbooks/mariadb/recipes/devel.rb +41 -0
- data/cookbooks/mariadb/recipes/galera.rb +324 -0
- data/cookbooks/mariadb/recipes/plugins.rb +3 -0
- data/cookbooks/mariadb/recipes/repository.rb +45 -0
- data/cookbooks/mariadb/recipes/server.rb +157 -0
- data/cookbooks/mariadb/resources/configuration.rb +13 -0
- data/cookbooks/mariadb/resources/mysql2_gem.rb +25 -0
- data/cookbooks/mariadb/resources/replication.rb +192 -0
- data/cookbooks/mariadb/templates/default/conf.d.generic.erb +19 -0
- data/cookbooks/mariadb/templates/default/debian.cnf.erb +12 -0
- data/cookbooks/mariadb/templates/default/mariadb-server.seed.erb +13 -0
- data/cookbooks/mariadb/templates/default/mariadb_grants.erb +42 -0
- data/cookbooks/mariadb/templates/default/my.cnf.erb +210 -0
- data/cookbooks/mariadb/templates/default/root.cnf.erb +5 -0
- data/cookbooks/mingw/.foodcritic +1 -0
- data/cookbooks/mingw/CHANGELOG.md +50 -0
- data/cookbooks/mingw/CONTRIBUTING.md +2 -0
- data/cookbooks/mingw/MAINTAINERS.md +14 -0
- data/cookbooks/mingw/README.md +133 -0
- data/cookbooks/mingw/files/default/bash.bat +17 -0
- data/cookbooks/mingw/files/default/custom-upgrade.sh +23 -0
- data/cookbooks/mingw/files/default/custom_prefix.sh +13 -0
- data/cookbooks/mingw/files/default/pthread.h +719 -0
- data/cookbooks/mingw/files/default/time.h +297 -0
- data/cookbooks/mingw/libraries/_helper.rb +38 -0
- data/cookbooks/mingw/metadata.json +1 -0
- data/cookbooks/mingw/recipes/default.rb +19 -0
- data/cookbooks/mingw/resources/get.rb +56 -0
- data/cookbooks/mingw/resources/msys2_package.rb +139 -0
- data/cookbooks/mingw/resources/tdm_gcc.rb +114 -0
- data/cookbooks/ohai/.foodcritic +2 -0
- data/cookbooks/ohai/CHANGELOG.md +166 -0
- data/cookbooks/ohai/CONTRIBUTING.md +2 -0
- data/cookbooks/ohai/MAINTAINERS.md +15 -0
- data/cookbooks/ohai/README.md +134 -0
- data/cookbooks/ohai/libraries/matchers.rb +41 -0
- data/cookbooks/ohai/metadata.json +1 -0
- data/cookbooks/ohai/recipes/default.rb +20 -0
- data/cookbooks/ohai/resources/hint.rb +55 -0
- data/cookbooks/ohai/resources/plugin.rb +117 -0
- data/cookbooks/selinux_policy/.gitignore +51 -0
- data/cookbooks/selinux_policy/.kitchen.yml +25 -0
- data/cookbooks/selinux_policy/.rubocop.yml +2 -0
- data/cookbooks/selinux_policy/.travis.yml +26 -0
- data/cookbooks/selinux_policy/Berksfile +8 -0
- data/cookbooks/selinux_policy/CHANGELOG.md +155 -0
- data/cookbooks/selinux_policy/LICENSE +13 -0
- data/cookbooks/selinux_policy/README.md +217 -0
- data/cookbooks/selinux_policy/Rakefile +68 -0
- data/cookbooks/selinux_policy/TESTING.md +2 -0
- data/cookbooks/selinux_policy/Thorfile +12 -0
- data/cookbooks/selinux_policy/attributes/default.rb +5 -0
- data/cookbooks/selinux_policy/chefignore +102 -0
- data/cookbooks/selinux_policy/libraries/helper-disabled.rb +29 -0
- data/cookbooks/selinux_policy/libraries/matchers.rb +57 -0
- data/cookbooks/selinux_policy/metadata.json +58 -0
- data/cookbooks/selinux_policy/metadata.rb +20 -0
- data/cookbooks/selinux_policy/providers/boolean.rb +28 -0
- data/cookbooks/selinux_policy/providers/fcontext.rb +78 -0
- data/cookbooks/selinux_policy/providers/module.rb +81 -0
- data/cookbooks/selinux_policy/providers/permissive.rb +26 -0
- data/cookbooks/selinux_policy/providers/port.rb +58 -0
- data/cookbooks/selinux_policy/recipes/default.rb +9 -0
- data/cookbooks/selinux_policy/recipes/install.rb +32 -0
- data/cookbooks/selinux_policy/resources/boolean.rb +8 -0
- data/cookbooks/selinux_policy/resources/fcontext.rb +8 -0
- data/cookbooks/selinux_policy/resources/module.rb +21 -0
- data/cookbooks/selinux_policy/resources/permissive.rb +6 -0
- data/cookbooks/selinux_policy/resources/port.rb +9 -0
- data/cookbooks/seven_zip/CHANGELOG.md +30 -0
- data/cookbooks/seven_zip/README.md +108 -0
- data/cookbooks/seven_zip/attributes/default.rb +31 -0
- data/cookbooks/seven_zip/libraries/matchers.rb +33 -0
- data/cookbooks/seven_zip/metadata.json +1 -0
- data/cookbooks/seven_zip/providers/archive.rb +68 -0
- data/cookbooks/seven_zip/recipes/default.rb +41 -0
- data/cookbooks/seven_zip/resources/archive.rb +29 -0
- data/cookbooks/windows/.foodcritic +2 -0
- data/cookbooks/windows/CHANGELOG.md +528 -0
- data/cookbooks/windows/CONTRIBUTING.md +2 -0
- data/cookbooks/windows/MAINTAINERS.md +21 -0
- data/cookbooks/windows/README.md +803 -0
- data/cookbooks/windows/attributes/default.rb +21 -0
- data/cookbooks/windows/files/dism_features.rb +45 -0
- data/cookbooks/windows/libraries/matchers.rb +586 -0
- data/cookbooks/windows/libraries/powershell_helper.rb +53 -0
- data/cookbooks/windows/libraries/registry_helper.rb +356 -0
- data/cookbooks/windows/libraries/version.rb +207 -0
- data/cookbooks/windows/libraries/version_helper.rb +79 -0
- data/cookbooks/windows/libraries/windows_helper.rb +174 -0
- data/cookbooks/windows/libraries/windows_privileged.rb +103 -0
- data/cookbooks/windows/libraries/wmi_helper.rb +32 -0
- data/cookbooks/windows/metadata.json +1 -0
- data/cookbooks/windows/recipes/default.rb +21 -0
- data/cookbooks/windows/resources/auto_run.rb +46 -0
- data/cookbooks/windows/resources/certificate.rb +166 -0
- data/cookbooks/windows/resources/certificate_binding.rb +128 -0
- data/cookbooks/windows/resources/feature.rb +82 -0
- data/cookbooks/windows/resources/feature_dism.rb +108 -0
- data/cookbooks/windows/resources/feature_powershell.rb +70 -0
- data/cookbooks/windows/resources/feature_servermanagercmd.rb +76 -0
- data/cookbooks/windows/resources/font.rb +80 -0
- data/cookbooks/windows/resources/http_acl.rb +110 -0
- data/cookbooks/windows/resources/pagefile.rb +152 -0
- data/cookbooks/windows/resources/path.rb +54 -0
- data/cookbooks/windows/resources/printer.rb +103 -0
- data/cookbooks/windows/resources/printer_port.rb +101 -0
- data/cookbooks/windows/resources/share.rb +291 -0
- data/cookbooks/windows/resources/shortcut.rb +53 -0
- data/cookbooks/windows/resources/task.rb +384 -0
- data/cookbooks/windows/resources/zipfile.rb +125 -0
- data/cookbooks/yum/.foodcritic +1 -0
- data/cookbooks/yum/CHANGELOG.md +351 -0
- data/cookbooks/yum/CONTRIBUTING.md +2 -0
- data/cookbooks/yum/MAINTAINERS.md +16 -0
- data/cookbooks/yum/README.md +125 -0
- data/cookbooks/yum/attributes/main.rb +103 -0
- data/cookbooks/yum/libraries/matchers.rb +9 -0
- data/cookbooks/yum/metadata.json +1 -0
- data/cookbooks/yum/recipes/default.rb +26 -0
- data/cookbooks/yum/recipes/dnf_yum_compat.rb +29 -0
- data/cookbooks/yum/resources/globalconfig.rb +119 -0
- data/cookbooks/yum/templates/.DS_Store +0 -0
- data/cookbooks/yum/templates/main.erb +276 -0
- data/cookbooks/yum-epel/CHANGELOG.md +138 -0
- data/cookbooks/yum-epel/CONTRIBUTING.md +2 -0
- data/cookbooks/yum-epel/MAINTAINERS.md +19 -0
- data/cookbooks/yum-epel/README.md +172 -0
- data/cookbooks/yum-epel/attributes/default.rb +8 -0
- data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel-source.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel-testing-source.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel-testing.rb +15 -0
- data/cookbooks/yum-epel/attributes/epel.rb +21 -0
- data/cookbooks/yum-epel/metadata.json +1 -0
- data/cookbooks/yum-epel/recipes/default.rb +27 -0
- data/cookbooks/yum-scl/.kitchen.dokken.yml +24 -0
- data/cookbooks/yum-scl/.kitchen.yml +24 -0
- data/cookbooks/yum-scl/.rubocop.yml +6 -0
- data/cookbooks/yum-scl/.travis.yml +28 -0
- data/cookbooks/yum-scl/Berksfile +3 -0
- data/cookbooks/yum-scl/Berksfile.lock +25 -0
- data/cookbooks/yum-scl/CHANGELOG.md +11 -0
- data/cookbooks/yum-scl/Gemfile +46 -0
- data/cookbooks/yum-scl/README.md +76 -0
- data/cookbooks/yum-scl/attributes/centos.rb +83 -0
- data/cookbooks/yum-scl/attributes/default.rb +15 -0
- data/cookbooks/yum-scl/attributes/scientific.rb +1 -0
- data/cookbooks/yum-scl/files/default/RPM-GPG-KEY-CentOS-SIG-SCLo +20 -0
- data/cookbooks/yum-scl/libraries/yum_scl_helper.rb +33 -0
- data/cookbooks/yum-scl/metadata.json +42 -0
- data/cookbooks/yum-scl/metadata.rb +12 -0
- data/cookbooks/yum-scl/recipes/chef_install.rb +52 -0
- data/cookbooks/yum-scl/recipes/default.rb +17 -0
- data/cookbooks/yum-scl/recipes/native_install.rb +35 -0
- data/lib/vagrant-clone/command/clone.rb +66 -61
- data/lib/vagrant-clone/errors.rb +61 -0
- data/lib/vagrant-clone/util/clone_manager_base.rb +69 -0
- data/lib/vagrant-clone/util/clone_managers/docker.rb +31 -0
- data/lib/vagrant-clone/util/clone_managers/libvirt.rb +254 -0
- data/lib/vagrant-clone/util/vagrantfile_managers/docker.rb +154 -0
- data/lib/vagrant-clone/util/vagrantfile_managers/libvirt.rb +159 -0
- data/lib/vagrant-clone/version.rb +2 -2
- data/lib/vagrant-clone.rb +6 -6
- data/libvirt.txt +7 -0
- data/performance_testing.rb +165 -0
- data/results.txt +45 -0
- data/scripts/create_box.sh +134 -0
- data/test.rb +92 -0
- data/tools/create_box.sh +130 -0
- data/vagrant-clone.gemspec +7 -7
- metadata +296 -5
- data/lib/vagrant-clone/command/errors.rb +0 -16
- data/lib/vagrant-clone/command/provider/docker.rb +0 -13
- data/lib/vagrant-clone/utils/vagrantfile_manager.rb +0 -47
@@ -0,0 +1,250 @@
|
|
1
|
+
# apt Cookbook
|
2
|
+
|
3
|
+
[][travis] [][cookbook]
|
4
|
+
|
5
|
+
This cookbook includes recipes to execute apt-get update to ensure the local APT package cache is up to date. There are recipes for managing the apt-cacher-ng caching proxy and proxy clients. It also includes a custom resource for pinning packages via /etc/apt/preferences.d.
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
### Platforms
|
10
|
+
|
11
|
+
- Ubuntu 12.04+
|
12
|
+
- Debian 7+
|
13
|
+
|
14
|
+
May work with or without modification on other Debian derivatives.
|
15
|
+
|
16
|
+
### Chef
|
17
|
+
|
18
|
+
- Chef 12.9+
|
19
|
+
|
20
|
+
### Cookbooks
|
21
|
+
|
22
|
+
- None
|
23
|
+
|
24
|
+
## Recipes
|
25
|
+
|
26
|
+
### default
|
27
|
+
|
28
|
+
This recipe manually updates the timestamp file used to only run `apt-get update` if the cache is more than one day old.
|
29
|
+
|
30
|
+
This recipe should appear first in the run list of Debian or Ubuntu nodes to ensure that the package cache is up to date before managing any `package` resources with Chef.
|
31
|
+
|
32
|
+
This recipe also sets up a local cache directory for preseeding packages.
|
33
|
+
|
34
|
+
**Including the default recipe on a node that does not support apt (such as Windows or RHEL) results in a noop.**
|
35
|
+
|
36
|
+
### cacher-client
|
37
|
+
|
38
|
+
Configures the node to use a `apt-cacher-ng` server to cache apt requests. Configuration of the server to use is located in `default['apt']['cacher_client']['cacher_server']` which is a hash containing `host`, `port`, `proxy_ssl`, and `bypass` keys. Example:
|
39
|
+
|
40
|
+
```json
|
41
|
+
{
|
42
|
+
"apt": {
|
43
|
+
"cacher_client": {
|
44
|
+
"cacher_server": {
|
45
|
+
"host": "cache_server.mycorp.dmz",
|
46
|
+
"port": 1234,
|
47
|
+
"proxy_ssl": true,
|
48
|
+
"cache_bypass": {
|
49
|
+
"download.oracle.com": "http"
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
```
|
56
|
+
|
57
|
+
#### Bypassing the cache
|
58
|
+
|
59
|
+
Occasionally you may come across repositories that do not play nicely when the node is using an `apt-cacher-ng` server. You can configure `cacher-client` to bypass the server and connect directly to the repository with the `cache_bypass` attribute.
|
60
|
+
|
61
|
+
To do this, you need to override the `cache_bypass` attribute with an hash of repositories, with each key as the repository URL and value as the protocol to use:
|
62
|
+
|
63
|
+
```json
|
64
|
+
{
|
65
|
+
"apt": {
|
66
|
+
"cacher_client": {
|
67
|
+
"cacher_server": {
|
68
|
+
"cache_bypass": {
|
69
|
+
"URL": "PROTOCOL"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
```
|
76
|
+
|
77
|
+
For example, to prevent caching and directly connect to the repository at `download.oracle.com` via http and the repo at `nginx.org` via https
|
78
|
+
|
79
|
+
```json
|
80
|
+
{
|
81
|
+
"apt": {
|
82
|
+
"cacher_client": {
|
83
|
+
"cacher_server": {
|
84
|
+
"cache_bypass": {
|
85
|
+
"download.oracle.com": "http",
|
86
|
+
"nginx.org": "https"
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
```
|
93
|
+
|
94
|
+
### cacher-ng
|
95
|
+
|
96
|
+
Installs the `apt-cacher-ng` package and service so the system can provide APT caching. You can check the usage report at <http://{hostname}:3142/acng-report.html>.
|
97
|
+
|
98
|
+
If you wish to help the `cacher-ng` recipe seed itself, you must now explicitly include the `cacher-client` recipe in your run list **after** `cacher-ng` or you will block your ability to install any packages (ie. `apt-cacher-ng`).
|
99
|
+
|
100
|
+
### unattended-upgrades
|
101
|
+
|
102
|
+
Installs and configures the `unattended-upgrades` package to provide automatic package updates. This can be configured to upgrade all packages or to just install security updates by setting `['apt']['unattended_upgrades']['allowed_origins']`.
|
103
|
+
|
104
|
+
To pull just security updates, set `origins_patterns` to something like `["origin=Ubuntu,archive=trusty-security"]` (for Ubuntu trusty) or `["origin=Debian,label=Debian-Security"]` (for Debian).
|
105
|
+
|
106
|
+
## Attributes
|
107
|
+
|
108
|
+
### General
|
109
|
+
|
110
|
+
- `['apt']['compile_time_update']` - force the default recipe to run `apt-get update` at compile time.
|
111
|
+
- `['apt']['periodic_update_min_delay']` - minimum delay (in seconds) between two actual executions of `apt-get update` by the `execute[apt-get-update-periodic]` resource, default is '86400' (24 hours)
|
112
|
+
|
113
|
+
### Caching
|
114
|
+
|
115
|
+
- `['apt']['cacher_client']['cacher_server']` - Hash containing server information used by clients for caching. See the example in the recipes section above for the full format of the hash.
|
116
|
+
- `['apt']['cacher_interface']` - interface to connect to the cacher-ng service, no default.
|
117
|
+
- `['apt']['cacher_port']` - port for the cacher-ng service (used by server recipe only), default is '3142'
|
118
|
+
- `['apt']['cacher_dir']` - directory used by cacher-ng service, default is '/var/cache/apt-cacher-ng'
|
119
|
+
- `['apt']['compiletime']` - force the `cacher-client` recipe to run before other recipes. It forces apt to use the proxy before other recipes run. Useful if your nodes have limited access to public apt repositories. This is overridden if the `cacher-ng` recipe is in your run list. Default is 'false'
|
120
|
+
|
121
|
+
### Unattended Upgrades
|
122
|
+
|
123
|
+
- `['apt']['unattended_upgrades']['enable']` - enables unattended upgrades, default is false
|
124
|
+
- `['apt']['unattended_upgrades']['update_package_lists']` - automatically update package list (`apt-get update`) daily, default is true
|
125
|
+
- `['apt']['unattended_upgrades']['allowed_origins']` - array of allowed apt origins from which to pull automatic upgrades, defaults to a guess at the system's main origin and should almost always be overridden
|
126
|
+
- `['apt']['unattended_upgrades']['origins_patterns']` - array of allowed apt origin patterns from which to pull automatic upgrades, defaults to none.
|
127
|
+
- `['apt']['unattended_upgrades']['package_blacklist']` - an array of package which should never be automatically upgraded, defaults to none
|
128
|
+
- `['apt']['unattended_upgrades']['auto_fix_interrupted_dpkg']` - attempts to repair dpkg state with `dpkg --force-confold --configure -a` if it exits uncleanly, defaults to false (contrary to the unattended-upgrades default)
|
129
|
+
- `['apt']['unattended_upgrades']['minimal_steps']` - Split the upgrade into the smallest possible chunks. This makes the upgrade a bit slower but it has the benefit that shutdown while a upgrade is running is possible (with a small delay). Defaults to false.
|
130
|
+
- `['apt']['unattended_upgrades']['install_on_shutdown']` - Install upgrades when the machine is shuting down instead of doing it in the background while the machine is running. This will (obviously) make shutdown slower. Defaults to false.
|
131
|
+
- `['apt']['unattended_upgrades']['mail']` - Send email to this address for problems or packages upgrades. Defaults to no email.
|
132
|
+
- `['apt']['unattended_upgrades']['mail_only_on_error']` - If set, email will only be set on upgrade errors. Otherwise, an email will be sent after each upgrade. Defaults to true.
|
133
|
+
- `['apt']['unattended_upgrades']['remove_unused_dependencies']` Do automatic removal of new unused dependencies after the upgrade. Defaults to false.
|
134
|
+
- `['apt']['unattended_upgrades']['automatic_reboot']` - Automatically reboots _without confirmation_ if a restart is required after the upgrade. Defaults to false.
|
135
|
+
- `['apt']['unattended_upgrades']['dl_limit']` - Limits the bandwidth used by apt to download packages. Value given as an integer in kb/sec. Defaults to nil (no limit).
|
136
|
+
- `['apt']['unattended_upgrades']['random_sleep]'` - Wait a random number of seconds up to this value before running daily periodic apt actions. System default is 1800 seconds (30 minutes).
|
137
|
+
|
138
|
+
### Configuration for APT
|
139
|
+
|
140
|
+
- `['apt']['confd']['force_confask']` - Prompt when overwriting configuration files. (default: false)
|
141
|
+
- `['apt']['confd']['force_confdef']` - Don't prompt when overwriting configuration files. (default: false)
|
142
|
+
- `['apt']['confd']['force_confmiss']` - Install removed configuration files when upgrading packages. (default: false)
|
143
|
+
- `['apt']['confd']['force_confnew']` - Overwrite configuration files when installing packages. (default: false)
|
144
|
+
- `['apt']['confd']['force_confold']` - Keep modified configuration files when installing packages. (default: false)
|
145
|
+
- `['apt']['confd']['install_recommends']` - Consider recommended packages as a dependency for installing. (default: true)
|
146
|
+
- `['apt']['confd']['install_suggests']` - Consider suggested packages as a dependency for installing. (default: false)
|
147
|
+
|
148
|
+
## Libraries
|
149
|
+
|
150
|
+
There is an `interface_ipaddress` method that returns the IP address for a particular host and interface, used by the `cacher-client` recipe. To enable it on the server use the `['apt']['cacher_interface']` attribute.
|
151
|
+
|
152
|
+
## Resources/Providers
|
153
|
+
|
154
|
+
### apt_preference
|
155
|
+
|
156
|
+
This resource provides an easy way to pin packages in /etc/apt/preferences.d. Although apt-pinning is quite helpful from time to time please note that Debian does not encourage its use without thorough consideration.
|
157
|
+
|
158
|
+
Further information regarding apt-pinning is available via <http://wiki.debian.org/AptPreferences>.
|
159
|
+
|
160
|
+
#### Actions
|
161
|
+
|
162
|
+
- `:add`: creates a preferences file under /etc/apt/preferences.d
|
163
|
+
- `:remove`: Removes the file, therefore unpin the package
|
164
|
+
|
165
|
+
#### Attribute Parameters
|
166
|
+
|
167
|
+
- package_name: name attribute. The name of the package
|
168
|
+
- glob: Pin by glob() expression or regexp surrounded by /.
|
169
|
+
- pin: The package version/repository to pin
|
170
|
+
- pin_priority: The pinning priority aka "the highest package version wins" (required)
|
171
|
+
|
172
|
+
#### Examples
|
173
|
+
|
174
|
+
Pin libmysqlclient16 to version 5.1.49-3:
|
175
|
+
|
176
|
+
```ruby
|
177
|
+
apt_preference 'libmysqlclient16' do
|
178
|
+
pin 'version 5.1.49-3'
|
179
|
+
pin_priority '700'
|
180
|
+
end
|
181
|
+
```
|
182
|
+
|
183
|
+
Unpin libmysqlclient16:
|
184
|
+
|
185
|
+
```ruby
|
186
|
+
apt_preference 'libmysqlclient16' do
|
187
|
+
action :remove
|
188
|
+
end
|
189
|
+
```
|
190
|
+
|
191
|
+
Pin all packages from dotdeb.org:
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
apt_preference 'dotdeb' do
|
195
|
+
glob '*'
|
196
|
+
pin 'origin packages.dotdeb.org'
|
197
|
+
pin_priority '700'
|
198
|
+
end
|
199
|
+
```
|
200
|
+
|
201
|
+
## Usage
|
202
|
+
|
203
|
+
Put `recipe[apt]` first in the run list. If you have other recipes that you want to use to configure how apt behaves, like new sources, notify the execute resource to run, e.g.:
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
template '/etc/apt/sources.list.d/my_apt_sources.list' do
|
207
|
+
notifies :run, 'execute[apt-get update]', :immediately
|
208
|
+
end
|
209
|
+
```
|
210
|
+
|
211
|
+
The above will run during execution phase since it is a normal template resource, and should appear before other package resources that need the sources in the template.
|
212
|
+
|
213
|
+
Put `recipe[apt::cacher-ng]` in the run_list for a server to provide APT caching and add `recipe[apt::cacher-client]` on the rest of the Debian-based nodes to take advantage of the caching server.
|
214
|
+
|
215
|
+
If you want to cleanup unused packages, there is also the `apt-get autoclean` and `apt-get autoremove` resources provided for automated cleanup.
|
216
|
+
|
217
|
+
### apt_repository
|
218
|
+
|
219
|
+
The apt_repository resource has been moved into chef-client in Chef 12.9.
|
220
|
+
|
221
|
+
See <https://docs.chef.io/resource_apt_repository.html> for usage details
|
222
|
+
|
223
|
+
### apt_update
|
224
|
+
|
225
|
+
The apt_update resource has been moved into chef-client in Chef 12.7.
|
226
|
+
|
227
|
+
See <https://docs.chef.io/resource_apt_update.html> for usage details
|
228
|
+
|
229
|
+
## License & Authors
|
230
|
+
|
231
|
+
**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))
|
232
|
+
|
233
|
+
**Copyright:** 2009-2016, Chef Software, Inc.
|
234
|
+
|
235
|
+
```
|
236
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
237
|
+
you may not use this file except in compliance with the License.
|
238
|
+
You may obtain a copy of the License at
|
239
|
+
|
240
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
241
|
+
|
242
|
+
Unless required by applicable law or agreed to in writing, software
|
243
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
244
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
245
|
+
See the License for the specific language governing permissions and
|
246
|
+
limitations under the License.
|
247
|
+
```
|
248
|
+
|
249
|
+
[cookbook]: https://community.chef.io/cookbooks/apt
|
250
|
+
[travis]: https://travis-ci.org/chef-cookbooks/apt
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook:: apt
|
3
|
+
# Attributes:: default
|
4
|
+
#
|
5
|
+
# Copyright:: 2009-2017, 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
|
+
default['apt']['cacher_dir'] = '/var/cache/apt-cacher-ng'
|
21
|
+
default['apt']['cacher_interface'] = nil
|
22
|
+
default['apt']['cacher_port'] = 3142
|
23
|
+
default['apt']['compiletime'] = false
|
24
|
+
default['apt']['compile_time_update'] = false
|
25
|
+
default['apt']['key_proxy'] = ''
|
26
|
+
default['apt']['periodic_update_min_delay'] = 86_400
|
27
|
+
default['apt']['launchpad_api_version'] = '1.0'
|
28
|
+
default['apt']['unattended_upgrades']['enable'] = false
|
29
|
+
default['apt']['unattended_upgrades']['update_package_lists'] = true
|
30
|
+
# this needs a good default
|
31
|
+
codename = node.attribute?('lsb') ? node['lsb']['codename'] : 'notlinux'
|
32
|
+
default['apt']['unattended_upgrades']['allowed_origins'] = [
|
33
|
+
"#{node['platform'].capitalize} #{codename}",
|
34
|
+
]
|
35
|
+
|
36
|
+
default['apt']['cacher_client']['cacher_server'] = {}
|
37
|
+
|
38
|
+
default['apt']['unattended_upgrades']['origins_patterns'] = []
|
39
|
+
default['apt']['unattended_upgrades']['package_blacklist'] = []
|
40
|
+
default['apt']['unattended_upgrades']['auto_fix_interrupted_dpkg'] = false
|
41
|
+
default['apt']['unattended_upgrades']['minimal_steps'] = false
|
42
|
+
default['apt']['unattended_upgrades']['install_on_shutdown'] = false
|
43
|
+
default['apt']['unattended_upgrades']['mail'] = nil
|
44
|
+
default['apt']['unattended_upgrades']['mail_only_on_error'] = true
|
45
|
+
default['apt']['unattended_upgrades']['remove_unused_dependencies'] = false
|
46
|
+
default['apt']['unattended_upgrades']['automatic_reboot'] = false
|
47
|
+
default['apt']['unattended_upgrades']['automatic_reboot_time'] = 'now'
|
48
|
+
default['apt']['unattended_upgrades']['dl_limit'] = nil
|
49
|
+
default['apt']['unattended_upgrades']['random_sleep'] = nil
|
50
|
+
|
51
|
+
default['apt']['confd']['force_confask'] = false
|
52
|
+
default['apt']['confd']['force_confdef'] = false
|
53
|
+
default['apt']['confd']['force_confmiss'] = false
|
54
|
+
default['apt']['confd']['force_confnew'] = false
|
55
|
+
default['apt']['confd']['force_confold'] = false
|
56
|
+
default['apt']['confd']['install_recommends'] = true
|
57
|
+
default['apt']['confd']['install_suggests'] = false
|
@@ -0,0 +1 @@
|
|
1
|
+
APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};
|
@@ -0,0 +1,50 @@
|
|
1
|
+
[DEFAULT]
|
2
|
+
;; All times are in seconds, but you can add a suffix
|
3
|
+
;; for minutes(m), hours(h) or days(d)
|
4
|
+
|
5
|
+
;; commented out address so apt-proxy will listen on all IPs
|
6
|
+
;; address = 127.0.0.1
|
7
|
+
port = 9999
|
8
|
+
cache_dir = /var/cache/apt-proxy
|
9
|
+
|
10
|
+
;; Control files (Packages/Sources/Contents) refresh rate
|
11
|
+
min_refresh_delay = 1s
|
12
|
+
complete_clientless_downloads = 1
|
13
|
+
|
14
|
+
;; Debugging settings.
|
15
|
+
debug = all:4 db:0
|
16
|
+
|
17
|
+
time = 30
|
18
|
+
passive_ftp = on
|
19
|
+
|
20
|
+
;;--------------------------------------------------------------
|
21
|
+
;; Cache housekeeping
|
22
|
+
|
23
|
+
cleanup_freq = 1d
|
24
|
+
max_age = 120d
|
25
|
+
max_versions = 3
|
26
|
+
|
27
|
+
;;---------------------------------------------------------------
|
28
|
+
;; Backend servers
|
29
|
+
;;
|
30
|
+
;; Place each server in its own [section]
|
31
|
+
|
32
|
+
[ubuntu]
|
33
|
+
; Ubuntu archive
|
34
|
+
backends =
|
35
|
+
http://us.archive.ubuntu.com/ubuntu
|
36
|
+
|
37
|
+
[ubuntu-security]
|
38
|
+
; Ubuntu security updates
|
39
|
+
backends = http://security.ubuntu.com/ubuntu
|
40
|
+
|
41
|
+
[debian]
|
42
|
+
;; Backend servers, in order of preference
|
43
|
+
backends =
|
44
|
+
http://debian.osuosl.org/debian/
|
45
|
+
|
46
|
+
[security]
|
47
|
+
;; Debian security archive
|
48
|
+
backends =
|
49
|
+
http://security.debian.org/debian-security
|
50
|
+
http://ftp2.de.debian.org/debian-security
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook:: apt
|
3
|
+
# Library:: helpers
|
4
|
+
#
|
5
|
+
# Copyright:: 2013-2017, 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
|
+
module Apt
|
21
|
+
# Helpers for apt
|
22
|
+
module Helpers
|
23
|
+
# Determines if apt is installed on a system.
|
24
|
+
#
|
25
|
+
# @return [Boolean]
|
26
|
+
def apt_installed?
|
27
|
+
!which('apt-get').nil?
|
28
|
+
end
|
29
|
+
|
30
|
+
# Finds a command in $PATH
|
31
|
+
#
|
32
|
+
# @return [String, nil]
|
33
|
+
def which(cmd)
|
34
|
+
ENV['PATH'] = '' if ENV['PATH'].nil?
|
35
|
+
paths = (ENV['PATH'].split(::File::PATH_SEPARATOR) + %w(/bin /usr/bin /sbin /usr/sbin))
|
36
|
+
|
37
|
+
paths.each do |path|
|
38
|
+
possible = File.join(path, cmd)
|
39
|
+
return possible if File.executable?(possible)
|
40
|
+
end
|
41
|
+
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Chef::Recipe.send(:include, ::Apt::Helpers)
|
48
|
+
Chef::Resource.send(:include, ::Apt::Helpers)
|
49
|
+
Chef::Provider.send(:include, ::Apt::Helpers)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
if defined?(ChefSpec)
|
2
|
+
|
3
|
+
#################
|
4
|
+
# apt_preference
|
5
|
+
#################
|
6
|
+
|
7
|
+
ChefSpec.define_matcher :apt_preference
|
8
|
+
|
9
|
+
def add_apt_preference(resource_name)
|
10
|
+
ChefSpec::Matchers::ResourceMatcher.new(:apt_preference, :add, resource_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
def remove_apt_preference(resource_name)
|
14
|
+
ChefSpec::Matchers::ResourceMatcher.new(:apt_preference, :remove, resource_name)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"apt","version":"6.1.0","description":"Configures apt and apt caching.","long_description":"# apt Cookbook\n\n[][travis] [][cookbook]\n\nThis cookbook includes recipes to execute apt-get update to ensure the local APT package cache is up to date. There are recipes for managing the apt-cacher-ng caching proxy and proxy clients. It also includes a custom resource for pinning packages via /etc/apt/preferences.d.\n\n## Requirements\n\n### Platforms\n\n- Ubuntu 12.04+\n- Debian 7+\n\nMay work with or without modification on other Debian derivatives.\n\n### Chef\n\n- Chef 12.9+\n\n### Cookbooks\n\n- None\n\n## Recipes\n\n### default\n\nThis recipe manually updates the timestamp file used to only run `apt-get update` if the cache is more than one day old.\n\nThis recipe should appear first in the run list of Debian or Ubuntu nodes to ensure that the package cache is up to date before managing any `package` resources with Chef.\n\nThis recipe also sets up a local cache directory for preseeding packages.\n\n**Including the default recipe on a node that does not support apt (such as Windows or RHEL) results in a noop.**\n\n### cacher-client\n\nConfigures the node to use a `apt-cacher-ng` server to cache apt requests. Configuration of the server to use is located in `default['apt']['cacher_client']['cacher_server']` which is a hash containing `host`, `port`, `proxy_ssl`, and `bypass` keys. Example:\n\n```json\n{\n \"apt\": {\n \"cacher_client\": {\n \"cacher_server\": {\n \"host\": \"cache_server.mycorp.dmz\",\n \"port\": 1234,\n \"proxy_ssl\": true,\n \"cache_bypass\": {\n \"download.oracle.com\": \"http\"\n }\n }\n }\n }\n}\n```\n\n#### Bypassing the cache\n\nOccasionally you may come across repositories that do not play nicely when the node is using an `apt-cacher-ng` server. You can configure `cacher-client` to bypass the server and connect directly to the repository with the `cache_bypass` attribute.\n\nTo do this, you need to override the `cache_bypass` attribute with an hash of repositories, with each key as the repository URL and value as the protocol to use:\n\n```json\n{\n \"apt\": {\n \"cacher_client\": {\n \"cacher_server\": {\n \"cache_bypass\": {\n \"URL\": \"PROTOCOL\"\n }\n }\n }\n }\n}\n```\n\nFor example, to prevent caching and directly connect to the repository at `download.oracle.com` via http and the repo at `nginx.org` via https\n\n```json\n{\n \"apt\": {\n \"cacher_client\": {\n \"cacher_server\": {\n \"cache_bypass\": {\n \"download.oracle.com\": \"http\",\n \"nginx.org\": \"https\" \n }\n }\n }\n }\n}\n```\n\n### cacher-ng\n\nInstalls the `apt-cacher-ng` package and service so the system can provide APT caching. You can check the usage report at <http://{hostname}:3142/acng-report.html>.\n\nIf you wish to help the `cacher-ng` recipe seed itself, you must now explicitly include the `cacher-client` recipe in your run list **after** `cacher-ng` or you will block your ability to install any packages (ie. `apt-cacher-ng`).\n\n### unattended-upgrades\n\nInstalls and configures the `unattended-upgrades` package to provide automatic package updates. This can be configured to upgrade all packages or to just install security updates by setting `['apt']['unattended_upgrades']['allowed_origins']`.\n\nTo pull just security updates, set `origins_patterns` to something like `[\"origin=Ubuntu,archive=trusty-security\"]` (for Ubuntu trusty) or `[\"origin=Debian,label=Debian-Security\"]` (for Debian).\n\n## Attributes\n\n### General\n\n- `['apt']['compile_time_update']` - force the default recipe to run `apt-get update` at compile time.\n- `['apt']['periodic_update_min_delay']` - minimum delay (in seconds) between two actual executions of `apt-get update` by the `execute[apt-get-update-periodic]` resource, default is '86400' (24 hours)\n\n### Caching\n\n- `['apt']['cacher_client']['cacher_server']` - Hash containing server information used by clients for caching. See the example in the recipes section above for the full format of the hash.\n- `['apt']['cacher_interface']` - interface to connect to the cacher-ng service, no default.\n- `['apt']['cacher_port']` - port for the cacher-ng service (used by server recipe only), default is '3142'\n- `['apt']['cacher_dir']` - directory used by cacher-ng service, default is '/var/cache/apt-cacher-ng'\n- `['apt']['compiletime']` - force the `cacher-client` recipe to run before other recipes. It forces apt to use the proxy before other recipes run. Useful if your nodes have limited access to public apt repositories. This is overridden if the `cacher-ng` recipe is in your run list. Default is 'false'\n\n### Unattended Upgrades\n\n- `['apt']['unattended_upgrades']['enable']` - enables unattended upgrades, default is false\n- `['apt']['unattended_upgrades']['update_package_lists']` - automatically update package list (`apt-get update`) daily, default is true\n- `['apt']['unattended_upgrades']['allowed_origins']` - array of allowed apt origins from which to pull automatic upgrades, defaults to a guess at the system's main origin and should almost always be overridden\n- `['apt']['unattended_upgrades']['origins_patterns']` - array of allowed apt origin patterns from which to pull automatic upgrades, defaults to none.\n- `['apt']['unattended_upgrades']['package_blacklist']` - an array of package which should never be automatically upgraded, defaults to none\n- `['apt']['unattended_upgrades']['auto_fix_interrupted_dpkg']` - attempts to repair dpkg state with `dpkg --force-confold --configure -a` if it exits uncleanly, defaults to false (contrary to the unattended-upgrades default)\n- `['apt']['unattended_upgrades']['minimal_steps']` - Split the upgrade into the smallest possible chunks. This makes the upgrade a bit slower but it has the benefit that shutdown while a upgrade is running is possible (with a small delay). Defaults to false.\n- `['apt']['unattended_upgrades']['install_on_shutdown']` - Install upgrades when the machine is shuting down instead of doing it in the background while the machine is running. This will (obviously) make shutdown slower. Defaults to false.\n- `['apt']['unattended_upgrades']['mail']` - Send email to this address for problems or packages upgrades. Defaults to no email.\n- `['apt']['unattended_upgrades']['mail_only_on_error']` - If set, email will only be set on upgrade errors. Otherwise, an email will be sent after each upgrade. Defaults to true.\n- `['apt']['unattended_upgrades']['remove_unused_dependencies']` Do automatic removal of new unused dependencies after the upgrade. Defaults to false.\n- `['apt']['unattended_upgrades']['automatic_reboot']` - Automatically reboots _without confirmation_ if a restart is required after the upgrade. Defaults to false.\n- `['apt']['unattended_upgrades']['dl_limit']` - Limits the bandwidth used by apt to download packages. Value given as an integer in kb/sec. Defaults to nil (no limit).\n- `['apt']['unattended_upgrades']['random_sleep]'` - Wait a random number of seconds up to this value before running daily periodic apt actions. System default is 1800 seconds (30 minutes).\n\n### Configuration for APT\n\n- `['apt']['confd']['force_confask']` - Prompt when overwriting configuration files. (default: false)\n- `['apt']['confd']['force_confdef']` - Don't prompt when overwriting configuration files. (default: false)\n- `['apt']['confd']['force_confmiss']` - Install removed configuration files when upgrading packages. (default: false)\n- `['apt']['confd']['force_confnew']` - Overwrite configuration files when installing packages. (default: false)\n- `['apt']['confd']['force_confold']` - Keep modified configuration files when installing packages. (default: false)\n- `['apt']['confd']['install_recommends']` - Consider recommended packages as a dependency for installing. (default: true)\n- `['apt']['confd']['install_suggests']` - Consider suggested packages as a dependency for installing. (default: false)\n\n## Libraries\n\nThere is an `interface_ipaddress` method that returns the IP address for a particular host and interface, used by the `cacher-client` recipe. To enable it on the server use the `['apt']['cacher_interface']` attribute.\n\n## Resources/Providers\n\n### apt_preference\n\nThis resource provides an easy way to pin packages in /etc/apt/preferences.d. Although apt-pinning is quite helpful from time to time please note that Debian does not encourage its use without thorough consideration.\n\nFurther information regarding apt-pinning is available via <http://wiki.debian.org/AptPreferences>.\n\n#### Actions\n\n- `:add`: creates a preferences file under /etc/apt/preferences.d\n- `:remove`: Removes the file, therefore unpin the package\n\n#### Attribute Parameters\n\n- package_name: name attribute. The name of the package\n- glob: Pin by glob() expression or regexp surrounded by /.\n- pin: The package version/repository to pin\n- pin_priority: The pinning priority aka \"the highest package version wins\" (required)\n\n#### Examples\n\nPin libmysqlclient16 to version 5.1.49-3:\n\n```ruby\napt_preference 'libmysqlclient16' do\n pin 'version 5.1.49-3'\n pin_priority '700'\nend\n```\n\nUnpin libmysqlclient16:\n\n```ruby\napt_preference 'libmysqlclient16' do\n action :remove\nend\n```\n\nPin all packages from dotdeb.org:\n\n```ruby\napt_preference 'dotdeb' do\n glob '*'\n pin 'origin packages.dotdeb.org'\n pin_priority '700'\nend\n```\n\n## Usage\n\nPut `recipe[apt]` first in the run list. If you have other recipes that you want to use to configure how apt behaves, like new sources, notify the execute resource to run, e.g.:\n\n```ruby\ntemplate '/etc/apt/sources.list.d/my_apt_sources.list' do\n notifies :run, 'execute[apt-get update]', :immediately\nend\n```\n\nThe above will run during execution phase since it is a normal template resource, and should appear before other package resources that need the sources in the template.\n\nPut `recipe[apt::cacher-ng]` in the run_list for a server to provide APT caching and add `recipe[apt::cacher-client]` on the rest of the Debian-based nodes to take advantage of the caching server.\n\nIf you want to cleanup unused packages, there is also the `apt-get autoclean` and `apt-get autoremove` resources provided for automated cleanup.\n\n### apt_repository\n\nThe apt_repository resource has been moved into chef-client in Chef 12.9.\n\nSee <https://docs.chef.io/resource_apt_repository.html> for usage details\n\n### apt_update\n\nThe apt_update resource has been moved into chef-client in Chef 12.7.\n\nSee <https://docs.chef.io/resource_apt_update.html> for usage details\n\n## License & Authors\n\n**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))\n\n**Copyright:** 2009-2016, Chef Software, Inc.\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n[cookbook]: https://community.chef.io/cookbooks/apt\n[travis]: https://travis-ci.org/chef-cookbooks/apt\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"ubuntu":">= 0.0.0","debian":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{"apt::default":"Runs apt-get update during compile phase and sets up preseed directories","apt::cacher-ng":"Set up an apt-cacher-ng caching proxy","apt::cacher-client":"Client for the apt::cacher-ng caching proxy"},"source_url":"https://github.com/chef-cookbooks/apt","issues_url":"https://github.com/chef-cookbooks/apt/issues","chef_version":[[">= 12.9"]],"ohai_version":[]}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook:: apt
|
3
|
+
# Recipe:: cacher-client
|
4
|
+
#
|
5
|
+
# Copyright:: 2011-2017, 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
|
+
# remove Acquire::http::Proxy lines from /etc/apt/apt.conf since we use 01proxy
|
21
|
+
# these are leftover from preseed installs
|
22
|
+
execute 'Remove proxy from /etc/apt/apt.conf' do
|
23
|
+
command "sed --in-place '/^Acquire::http::Proxy/d' /etc/apt/apt.conf"
|
24
|
+
only_if 'grep Acquire::http::Proxy /etc/apt/apt.conf'
|
25
|
+
end
|
26
|
+
|
27
|
+
if node['apt']['cacher_client']['cacher_server'].empty?
|
28
|
+
Chef::Log.warn("No cache server defined in node['apt']['cacher_servers']. Not setting up caching")
|
29
|
+
f = file '/etc/apt/apt.conf.d/01proxy' do
|
30
|
+
action(node['apt']['compiletime'] ? :nothing : :delete)
|
31
|
+
end
|
32
|
+
f.run_action(:delete) if node['apt']['compiletime']
|
33
|
+
else
|
34
|
+
apt_update 'update for notification' do
|
35
|
+
action :nothing
|
36
|
+
end
|
37
|
+
|
38
|
+
t = template '/etc/apt/apt.conf.d/01proxy' do
|
39
|
+
source '01proxy.erb'
|
40
|
+
owner 'root'
|
41
|
+
group 'root'
|
42
|
+
mode '0644'
|
43
|
+
variables(
|
44
|
+
server: node['apt']['cacher_client']['cacher_server']
|
45
|
+
)
|
46
|
+
action(node['apt']['compiletime'] ? :nothing : :create)
|
47
|
+
notifies :update, 'apt_update[update for notification]', :immediately
|
48
|
+
end
|
49
|
+
t.run_action(:create) if node['apt']['compiletime']
|
50
|
+
end
|
51
|
+
|
52
|
+
include_recipe 'apt::default'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook:: apt
|
3
|
+
# Recipe:: cacher-ng
|
4
|
+
#
|
5
|
+
# Copyright:: 2008-2017, 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
|
+
package 'apt-cacher-ng'
|
21
|
+
|
22
|
+
directory node['apt']['cacher_dir'] do
|
23
|
+
owner 'apt-cacher-ng'
|
24
|
+
group 'apt-cacher-ng'
|
25
|
+
mode '0755'
|
26
|
+
end
|
27
|
+
|
28
|
+
template '/etc/apt-cacher-ng/acng.conf' do
|
29
|
+
source 'acng.conf.erb'
|
30
|
+
owner 'root'
|
31
|
+
group 'root'
|
32
|
+
mode '0644'
|
33
|
+
notifies :restart, 'service[apt-cacher-ng]', :immediately
|
34
|
+
end
|
35
|
+
|
36
|
+
service 'apt-cacher-ng' do
|
37
|
+
supports restart: true, status: false
|
38
|
+
action [:enable, :start]
|
39
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook:: apt
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Copyright:: 2008-2017, Chef Software, Inc.
|
6
|
+
# Copyright:: 2009-2017, 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
|
+
file '/var/lib/apt/periodic/update-success-stamp' do
|
27
|
+
owner 'root'
|
28
|
+
group 'root'
|
29
|
+
action :nothing
|
30
|
+
end
|
31
|
+
|
32
|
+
# If compile_time_update run apt-get update at compile time
|
33
|
+
if node['apt']['compile_time_update'] && apt_installed?
|
34
|
+
apt_update('compile time').run_action(:periodic)
|
35
|
+
end
|
36
|
+
|
37
|
+
apt_update 'periodic'
|
38
|
+
|
39
|
+
# For other recipes to call to force an update
|
40
|
+
execute 'apt-get update' do
|
41
|
+
command 'apt-get update'
|
42
|
+
ignore_failure true
|
43
|
+
action :nothing
|
44
|
+
notifies :touch, 'file[/var/lib/apt/periodic/update-success-stamp]', :immediately
|
45
|
+
only_if { apt_installed? }
|
46
|
+
end
|
47
|
+
|
48
|
+
# Automatically remove packages that are no longer needed for dependencies
|
49
|
+
execute 'apt-get autoremove' do
|
50
|
+
command 'apt-get -y autoremove'
|
51
|
+
environment(
|
52
|
+
'DEBIAN_FRONTEND' => 'noninteractive'
|
53
|
+
)
|
54
|
+
action :nothing
|
55
|
+
only_if { apt_installed? }
|
56
|
+
end
|
57
|
+
|
58
|
+
# Automatically remove .deb files for packages no longer on your system
|
59
|
+
execute 'apt-get autoclean' do
|
60
|
+
command 'apt-get -y autoclean'
|
61
|
+
action :nothing
|
62
|
+
only_if { apt_installed? }
|
63
|
+
end
|
64
|
+
|
65
|
+
%w(/var/cache/local /var/cache/local/preseeding).each do |dirname|
|
66
|
+
directory dirname do
|
67
|
+
owner 'root'
|
68
|
+
group 'root'
|
69
|
+
mode '0755'
|
70
|
+
action :create
|
71
|
+
only_if { apt_installed? }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
template '/etc/apt/apt.conf.d/10dpkg-options' do
|
76
|
+
owner 'root'
|
77
|
+
group 'root'
|
78
|
+
mode '0644'
|
79
|
+
source '10dpkg-options.erb'
|
80
|
+
only_if { apt_installed? }
|
81
|
+
end
|
82
|
+
|
83
|
+
template '/etc/apt/apt.conf.d/10recommends' do
|
84
|
+
owner 'root'
|
85
|
+
group 'root'
|
86
|
+
mode '0644'
|
87
|
+
source '10recommends.erb'
|
88
|
+
only_if { apt_installed? }
|
89
|
+
end
|
90
|
+
|
91
|
+
package 'apt-transport-https' do
|
92
|
+
only_if { apt_installed? }
|
93
|
+
end
|