Adding values to Ensure [on top of present and absent]

asked 2018-01-24 00:26:02 -0600 gravatar image

updated 2018-01-28 23:45:08 -0600

Ensure by default in puppet provides "present" and "absent". Is there way in which we can have "present", "absent" and "modify" ?

More details :-

By default, in providers, we can write our create and delete methods in puppet. Is there a way we can add more methods than this.

Example case can be would be having following methods :-

create delete modify etc.

Can you provide me with a link for an example.

Edit to provide more details :-

We are implementing our own resources and providers. We want to know how to modify existing resource.

Example :-

I have volume of size 1GB and I want to increase the size to 4GB. How would I implement in puppet provider ?

edit retag flag offensive close merge delete



Can you please explain a little more what you are trying to achieve? Please edit your question to fill in more details.

Mr_Sharma gravatar imageMr_Sharma ( 2018-01-24 04:11:46 -0600 )edit

This is the limitation based on the action available to manage any resource. e.g. you can either create or delete a file but can't modify during puppet run using the same resource. Modification can be done using other resource.

Mr_Sharma gravatar imageMr_Sharma ( 2018-01-24 04:36:35 -0600 )edit

In other way, you can create your own custom resource as well called Defines based on your requirement. Link: , may be this is not what you looking for.

Mr_Sharma gravatar imageMr_Sharma ( 2018-01-24 04:39:55 -0600 )edit

If you are creating your own resource, you can define any value/parameter you want for an Ensure parameter, you just have to add the logic of how to handle them. Echoing the above, what are you actually trying to accomplish that you think you need more 'ensure' options?

DarylW gravatar imageDarylW ( 2018-01-24 10:48:39 -0600 )edit

If you are trying to have multiple resources defining the same object, that is not the way puppet is defined. It is expected that you have a single resource which brings together all of the information about a resource, and declares how it should be.

DarylW gravatar imageDarylW ( 2018-01-24 10:49:32 -0600 )edit