Initial commit
This commit is contained in:
commit
48eb90d42e
9 changed files with 227 additions and 0 deletions
20
.gitignore
vendored
Normal file
20
.gitignore
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
*~
|
||||
*#
|
||||
.#*
|
||||
\#*#
|
||||
.*.sw[a-z]
|
||||
*.un~
|
||||
pkg/
|
||||
|
||||
# Berkshelf
|
||||
.vagrant
|
||||
/cookbooks
|
||||
Berksfile.lock
|
||||
|
||||
# Bundler
|
||||
Gemfile.lock
|
||||
bin/*
|
||||
.bundle/*
|
||||
|
||||
.kitchen/
|
||||
.kitchen.local.yml
|
7
Berksfile
Normal file
7
Berksfile
Normal file
|
@ -0,0 +1,7 @@
|
|||
source "https://supermarket.chef.io"
|
||||
|
||||
metadata
|
||||
|
||||
cookbook "yum", "~> 3.10.0"
|
||||
cookbook "yum-epel", "~> 0.6.6"
|
||||
|
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# yum-zabbix Cookbook CHANGELOG
|
||||
This file is used to list changes made in each version of the yum-zabbix cookbook.
|
||||
|
||||
## v0.1.0
|
||||
initial release
|
106
README.md
Normal file
106
README.md
Normal file
|
@ -0,0 +1,106 @@
|
|||
# yum-zabbix Cookbook
|
||||
|
||||
The yum-zabbix cookbook takes over management of the default repositoryids that ship with CentOS systems. It allows attribute manipulation of `zabbix`, `zabbix-non-supported`
|
||||
|
||||
## Requirements
|
||||
### Platforms
|
||||
- RHEL/CentOS and derivatives
|
||||
|
||||
### Chef
|
||||
- Chef 11+
|
||||
|
||||
### Cookbooks
|
||||
- yum version 3.2.0 or higher
|
||||
- yum-epel
|
||||
|
||||
## Attributes
|
||||
The following attributes are set by default
|
||||
|
||||
```ruby
|
||||
default['yum']['zabbix']['repositoryid'] = 'zabbix'
|
||||
default['yum']['zabbix']['enabled'] = true
|
||||
default['yum']['zabbix']['managed'] = true
|
||||
default['yum']['zabbix']['gpgkey'] = 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX'
|
||||
default['yum']['zabbix']['gpgcheck'] = true
|
||||
default['yum']['zabbix']['description'] = 'Zabbix Official Repository - $basearch'
|
||||
default['yum']['zabbix']['baseurl'] = 'http://repo.zabbix.com/zabbix/3.0/rhel/6/$basearch'
|
||||
```
|
||||
|
||||
```ruby
|
||||
default['yum']['zabbix-non-supported']['repositoryid'] = 'zabbix-non-supported'
|
||||
default['yum']['zabbix-non-supported']['enabled'] = false
|
||||
default['yum']['zabbix-non-supported']['managed'] = false
|
||||
default['yum']['zabbix-non-supported']['gpgkey'] = 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX'
|
||||
default['yum']['zabbix-non-supported']['gpgcheck'] = true
|
||||
default['yum']['zabbix-non-supported']['description'] = 'Zabbix Official Repository non-supported - $basearch'
|
||||
default['yum']['zabbix-non-supported']['baseurl'] = 'http://repo.zabbix.com/non-supported/rhel/6/$basearch/'
|
||||
```
|
||||
|
||||
## Recipes
|
||||
- default - Walks through node attributes and feeds a yum_resource
|
||||
- parameters. The following is an example a resource generated by the
|
||||
- recipe during compilation.
|
||||
|
||||
```ruby
|
||||
yum_repository 'zabbix' do
|
||||
baseurl 'http://repo.zabbix.com/zabbix/3.0/rhel/6/$basearch/'
|
||||
description 'Zabbix Official Repository - $basearch'
|
||||
enabled true
|
||||
gpgcheck true
|
||||
gpgkey 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX'
|
||||
end
|
||||
```
|
||||
|
||||
## Usage Example
|
||||
To disable the `zabbix` repository through a Role or Environment definition
|
||||
|
||||
```
|
||||
default_attributes(
|
||||
'yum' => {
|
||||
'zabbix' => {
|
||||
'enabled' => false
|
||||
}
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
Uncommonly used repositoryids are not managed by default. This is speeds up integration testing pipelines by avoiding yum-cache builds that nobody cares about. To enable the `zabbix-non-supported` repository with a wrapper cookbook, place the following in a recipe:
|
||||
|
||||
```
|
||||
node.default['yum']['zabbix-non-supported']['managed'] = true
|
||||
node.default['yum']['zabbix-non-supported']['enabled'] = true
|
||||
include_recipe 'yum-zabbix'
|
||||
```
|
||||
|
||||
## More Examples
|
||||
Point the base and debuginfo repositories at an internally hosted server.
|
||||
|
||||
```
|
||||
node.default['yum']['zabbix']['enabled'] = true
|
||||
node.default['yum']['zabbix']['baseurl'] = 'https://internal.example.com/centos/6/os/x86_64'
|
||||
node.default['yum']['zabbix']['sslverify'] = false
|
||||
node.default['yum']['zabbix-non-supported']['enabled'] = true
|
||||
node.default['yum']['zabbix-non-supported']['baseurl'] = 'https://internal.example.com/centos/6/updates/x86_64'
|
||||
node.default['yum']['zabbix-non-supported']['sslverify'] = false
|
||||
|
||||
include_recipe 'yum-zabbix'
|
||||
```
|
||||
|
||||
## License & Authors
|
||||
**Author:** Eric Renfro (<psi-jack@linux-help.org>)
|
||||
|
||||
**Copyright:** 2016, Linux-Help.org.
|
||||
|
||||
```
|
||||
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.
|
||||
```
|
1
attributes/default.rb
Normal file
1
attributes/default.rb
Normal file
|
@ -0,0 +1 @@
|
|||
default['yum-zabbix']['repositories'] = %w(zabbix zabbix-non-supported)
|
9
attributes/zabbix-non-supported.rb
Normal file
9
attributes/zabbix-non-supported.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
default['yum']['zabbix-non-supported']['repositoryid'] = 'zabbix-non-supported'
|
||||
default['yum']['zabbix-non-supported']['enabled'] = false
|
||||
default['yum']['zabbix-non-supported']['managed'] = false
|
||||
default['yum']['zabbix-non-supported']['gpgkey'] = 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX'
|
||||
default['yum']['zabbix-non-supported']['gpgcheck'] = true
|
||||
|
||||
default['yum']['zabbix-non-supported']['description'] = 'Zabbix Official Repository - $basearch'
|
||||
default['yum']['zabbix-non-supported']['baseurl'] = "http://repo.zabbix.com/non-supported/rhel/#{node['platform_version'].to_i}/$basearch/"
|
||||
|
11
attributes/zabbix.rb
Normal file
11
attributes/zabbix.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
default['yum']['zabbix']['repositoryid'] = 'zabbix'
|
||||
default['yum']['zabbix']['enabled'] = true
|
||||
default['yum']['zabbix']['managed'] = true
|
||||
default['yum']['zabbix']['gpgkey'] = 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX'
|
||||
default['yum']['zabbix']['gpgcheck'] = true
|
||||
default['yum']['zabbix']['release_repo'] = '3.0'
|
||||
|
||||
default['yum']['zabbix']['description'] = 'Zabbix Official Repository - $basearch'
|
||||
|
||||
default['yum']['zabbix']['baseurl'] = "http://repo.zabbix.com/zabbix/#{node['yum']['zabbix']['release_repo']}/rhel/#{node['platform_version'].to_i}/$basearch/"
|
||||
|
17
metadata.rb
Normal file
17
metadata.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
name 'yum-zabbix'
|
||||
maintainer 'Eric Renfro'
|
||||
maintainer_email 'psi-jack@linux-help.org'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs and configures the NUX Community Desktop Yum Repository'
|
||||
long_description ''
|
||||
version '0.1.1'
|
||||
issues_url 'http://gogs.home.ld/Linux-Help/cookbook-yum-zabbix/issues'
|
||||
source_url 'http://gogs.home.ld/Linux-Help/cookbook-yum-zabbix'
|
||||
|
||||
%w{ centos redhat oracle scientific }.each do |os|
|
||||
supports os, '>= 5.0.0'
|
||||
end
|
||||
|
||||
depends 'yum', '>= 3.2'
|
||||
depends 'yum-epel', '>= 0.0.0'
|
||||
|
51
recipes/default.rb
Normal file
51
recipes/default.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
#
|
||||
# Author:: Eric Renfro (<psi-jack@linux-help.org>)
|
||||
# Recipe:: yum-zabbix::default
|
||||
#
|
||||
# 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['yum-zabbix']['repositories'].each do |repo|
|
||||
next unless node['yum'][repo]['managed']
|
||||
include_recipe 'yum-epel' unless run_context.loaded_recipe?('yum-epel')
|
||||
|
||||
yum_repository repo do
|
||||
description node['yum'][repo]['description'] unless node['yum'][repo]['description'].nil?
|
||||
baseurl node['yum'][repo]['baseurl'] unless node['yum'][repo]['baseurl'].nil?
|
||||
mirrorlist node['yum'][repo]['mirrorlist'] unless node['yum'][repo]['mirrorlist'].nil?
|
||||
gpgcheck node['yum'][repo]['gpgcheck'] unless node['yum'][repo]['gpgcheck'].nil?
|
||||
gpgkey node['yum'][repo]['gpgkey'] unless node['yum'][repo]['gpgkey'].nil?
|
||||
enabled node['yum'][repo]['enabled'] unless node['yum'][repo]['enabled'].nil?
|
||||
cost node['yum'][repo]['cost'] unless node['yum'][repo]['cost'].nil?
|
||||
exclude node['yum'][repo]['exclude'] unless node['yum'][repo]['exclude'].nil?
|
||||
enablegroups node['yum'][repo]['enablegroups'] unless node['yum'][repo]['enablegroups'].nil?
|
||||
failovermethod node['yum'][repo]['failovermethod'] unless node['yum'][repo]['failovermethod'].nil?
|
||||
http_caching node['yum'][repo]['http_caching'] unless node['yum'][repo]['http_caching'].nil?
|
||||
include_config node['yum'][repo]['include_config'] unless node['yum'][repo]['include_config'].nil?
|
||||
includepkgs node['yum'][repo]['includepkgs'] unless node['yum'][repo]['includepkgs'].nil?
|
||||
keepalive node['yum'][repo]['keepalive'] unless node['yum'][repo]['keepalive'].nil?
|
||||
max_retries node['yum'][repo]['max_retries'] unless node['yum'][repo]['max_retries'].nil?
|
||||
metadata_expire node['yum'][repo]['metadata_expire'] unless node['yum'][repo]['metadata_expire'].nil?
|
||||
mirror_expire node['yum'][repo]['mirror_expire'] unless node['yum'][repo]['mirror_expire'].nil?
|
||||
priority node['yum'][repo]['priority'] unless node['yum'][repo]['priority'].nil?
|
||||
proxy node['yum'][repo]['proxy'] unless node['yum'][repo]['proxy'].nil?
|
||||
proxy_username node['yum'][repo]['proxy_username'] unless node['yum'][repo]['proxy_username'].nil?
|
||||
proxy_password node['yum'][repo]['proxy_password'] unless node['yum'][repo]['proxy_password'].nil?
|
||||
repositoryid node['yum'][repo]['repositoryid'] unless node['yum'][repo]['repositoryid'].nil?
|
||||
sslcacert node['yum'][repo]['sslcacert'] unless node['yum'][repo]['sslcacert'].nil?
|
||||
sslclientcert node['yum'][repo]['sslclientcert'] unless node['yum'][repo]['sslclientcert'].nil?
|
||||
sslclientkey node['yum'][repo]['sslclientkey'] unless node['yum'][repo]['sslclientkey'].nil?
|
||||
sslverify node['yum'][repo]['sslverify'] unless node['yum'][repo]['sslverify'].nil?
|
||||
timeout node['yum'][repo]['timeout'] unless node['yum'][repo]['timeout'].nil?
|
||||
action :create
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue