Mirror rpm repository with reposync
.
- Centos 6.x/7.x
- Rhel 6.x/7.x
- Chef version: >= 12.5.1
Using this cookbook will mirror any rpm repository based on the tool reposync
.
For instance:
reposync_mirror 'couchbase' do
repofile 'http://packages.couchbase.com/rpm/couchbase-centos62-x86_64.repo'
update 'chef'
end
This provider allows to mirror a rpm repository
Action | Description |
---|---|
create | Create a mirror |
delete | Remove a mirrorred repository |
Name | Description | Default | Type |
---|---|---|---|
reponame |
repository name | name | String |
repofile |
In case the repository maintainer already provides a repository file | nil | URL identifier |
baseurl |
In case the repository uses a baseurl | nil | URL identifier |
cookbook |
The cookbook where to find the template for the reposync configuration | cookbook | String |
update |
The repository refresher method | daily | See Refreshers Methods |
hour |
The hour when to run the refresher if not launched by chef | * | String |
minute |
The minute when to run the refresher if not launched by chef | 0 | String |
weekday |
The weekday when to run the refresher if not launched by chef | 0 | String |
timeout |
The timeout before stopping the mirrorring | 7200 | String |
remove_repo |
Define if a repository has be removed once it is deleted | true | Boolean |
conf_dir |
Define configuration directory | /etc/reposync.d | String |
dest_dir |
Define destination directory | /var/opt/reposync | String |
cmd_args |
Define additional command line arguments | nil | [String, nil] |
References:
- The
URL identifier
are defined as follow:
Protocol | Definition |
---|---|
HTTP URL | http:// |
FTP URL | ftp:// |
File | file:// |
- Refresher Methods
Name | Frequence |
---|---|
daily |
Once a daily |
weekly |
Once a weekly |
chef |
Every chef run |
For instance:
# To mirror PowerDNS repositories at every chef run
include_recipe 'reposync'
reposync_mirror 'PowerDNS Auth 40' do
repofile 'https://repo.powerdns.com/repo-files/centos-auth-40.repo'
update 'chef'
end
default['reposync_config']['mirror'] = {
'couchbase' => {
repofile: 'http://packages.couchbase.com/rpm/couchbase-centos62-x86_64.repo',
weekday: '*',
},
'grafana-7' => {
baseurl: 'https://packagecloud.io/grafana/stable/el/7/x86_64',
weekday: '*',
},
}
node['reposync_config']['mirror'].each do |repo_name, repo_config|
reposync_mirror repo_name do
repo_config.each do |k, v|
instance_variable_set "@#{k}", v
end
end
end
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
Authors: Jeremy Mauro ([email protected])
Copyright 2014-2015, Criteo.
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.