zypper_repository resource¶
Use the zypper_repository resource to create Zypper package repositories on SUSE Enterprise Linux and openSUSE systems. This resource maintains full compatibility with the zypper_repository resource in the existing zypper cookbook.
New in Chef Client 13.3.
Syntax¶
The zypper_repository resource has the following syntax:
zypper_repository 'name' do
autorefresh true, false # default value: true
baseurl String
cookbook String
description String
enabled true, false # default value: true
gpgautoimportkeys true, false # default value: true
gpgcheck true, false # default value: true
gpgkey String
keeppackages true, false # default value: false
mirrorlist String
mode String, Integer # default value: 0644
path String
priority Integer # default value: 99
refresh_cache true, false # default value: true
repo_name String # default value: 'name' unless specified
source String
type String # default value: NONE
action Symbol # defaults to :create if not specified
end
where:
zypper_repositoryis the resource.nameis the name given to the resource block.actionidentifies which steps the chef-client will take to bring the node into the desired state.autorefresh,baseurl,cookbook,description,enabled,gpgautoimportkeys,gpgcheck,gpgkey,keeppackages,mirrorlist,mode,path,priority,refresh_cache,repo_name,source, andtypeare the properties available to this resource.
Actions¶
The zypper_repository resource has the following actions:
:add
Default action. Add a new Zypper repository.
:remove
Remove a Zypper repository.
:refresh
Refresh a Zypper repository.
Properties¶
The zypper_repository resource has the following properties:
autorefreshRuby Type: true, false | Default Value:
trueDetermines whether or not the repository should be refreshed automatically.
baseurlRuby Type: String
The base URL for the Zypper repository, such as
http://download.opensuse.org.cookbookRuby Type: String
The cookbook to source the repository template file from. Only necessary if you’re not using the built in template.
descriptionRuby Type: String
The description of the repository that will be shown by the
zypper reposcommand.enabledRuby Type: true, false | Default Value:
trueDetermines whether or not the repository should be enabled.
gpgautoimportkeysRuby Type: true, false | Default Value:
trueAutomatically import the specified key when setting up the repository.
gpgcheckRuby Type: true, false | Default Value:
trueDetermines whether or not to perform a GPG signature check on the repository.
gpgkeyRuby Type: String
The location of the repository key to be imported.
keeppackagesRuby Type: true, false | Default Value:
falseDetermines whether or not packages should be saved.
mirrorlistRuby Type: String
The URL of the mirror list that will be used.
modeRuby Type: String, Integer | Default Value:
0644The file mode of the repository file.
notifiesRuby Type: Symbol, ‘Chef::Resource[String]’
A resource may notify another resource to take action when its state changes. Specify a
'resource[name]', the:actionthat resource should take, and then the:timerfor that action. A resource may notify more than one resource; use anotifiesstatement for each resource to be notified.A timer specifies the point during the Chef Client run at which a notification is run. The following timers are available:
:before- Specifies that the action on a notified resource should be run before processing the resource block in which the notification is located.
:delayed- Default. Specifies that a notification should be queued up, and then executed at the end of the Chef Client run.
:immediate,:immediately- Specifies that a notification should be run immediately, per resource notified.
The syntax for
notifiesis:notifies :action, 'resource[name]', :timer
pathRuby Type: String
The relative path from the repository’s base URL.
priorityRuby Type: Integer | Default Value:
99Determines the priority of the Zypper repository.
refresh_cacheRuby Type: true, false | Default Value:
trueDetermines whether or not the package cache should be refreshed.
repo_nameRuby Type: String | Default Value:
'name'Specifies the repository name, if it differs from the resource name.
sourceRuby Type: String
The name of the template for the repository file. Only necessary if you’re not using the built in template.
subscribesRuby Type: Symbol, ‘Chef::Resource[String]’
A resource may listen to another resource, and then take action if the state of the resource being listened to changes. Specify a
'resource[name]', the:actionto be taken, and then the:timerfor that action.Note that
subscribesdoes not apply the specified action to the resource that it listens to - for example:file '/etc/nginx/ssl/example.crt' do mode '0600' owner 'root' end service 'nginx' do subscribes :reload, 'file[/etc/nginx/ssl/example.crt]', :immediately end
In this case the
subscribesproperty reloads thenginxservice whenever its certificate file, located under/etc/nginx/ssl/example.crt, is updated.subscribesdoes not make any changes to the certificate file itself, it merely listens for a change to the file, and executes the:reloadaction for its resource (in this examplenginx) when a change is detected.A timer specifies the point during the Chef Client run at which a notification is run. The following timers are available:
:before- Specifies that the action on a notified resource should be run before processing the resource block in which the notification is located.
:delayed- Default. Specifies that a notification should be queued up, and then executed at the end of the Chef Client run.
:immediate,:immediately- Specifies that a notification should be run immediately, per resource notified.
The syntax for
subscribesis:subscribes :action, 'resource[name]', :timer
typeRuby Type: String | Default Value:
NONESpecifies the repository type.
Examples¶
Add a repository
This example adds the “Apache” repository for OpenSUSE Leap 42.2:
zypper_repository 'apache' do
baseurl 'http://download.opensuse.org/repositories/Apache'
path '/openSUSE_Leap_42.2'
type 'rpm-md'
priority '100'
end