Ask Your Question

What happens if the ensure attribute fails for a resource?

asked 2015-02-27 12:31:48 -0600

vinay gravatar image

Here :

Under the Attributes section, ensure is defined as:

ensure (Property: This attribute represents concrete state on the target system.)

The basic property that the resource should be in.

Valid values are present, absent.

I wanted to know what happens in case the resource is not already present? Will it be installed? For example, for a resource "mlocate", I want to ensure that it is present and if it is not, I want to do a "yum install mlocate". Is this something that "ensure" enables me to do?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-28 14:13:49 -0600

doc75 gravatar image

I do not know yum, but the equivalent in Debian (apt). If you need to install a package usually you do it like this:

package{ 'package-name':
  ensure => 'present',

Here the keyword present ensure that if the package is installed nothing is done and if it is not yet install, then package manager install it.

Hope this helps.

edit flag offensive delete link more


Thank you so much for your answer doc75! It clarified my doubt.

vinay gravatar imagevinay ( 2015-03-01 10:57:16 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-02-27 12:31:48 -0600

Seen: 174 times

Last updated: Feb 28 '15