Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use Augeas to modify "/etc/inittab", but this should only happen when the package "sysvinit" is installed. That package is not under Puppet control (and shall not be).

The "onlyif" from Augeas doesn´t seem capable of checking for anything else than Augeas stuff, i.d. Augeas cannot check if file exists.

Is there a way to achieve this without creating a custom fact?

share|improve this question
You might be to a point where you are just going to have make yourself a custom fact that tells you if sysvinit is installed. – Zoredache Mar 14 '14 at 17:18

Write an Augeas provider and confine it to a fact which checks for the package's presence.

To sum it up:

  • Write a sysvinit_package fact, with value true or false (or even the package version)
  • Write a type and provider for inittab which is confined to the fact.

Note: the augeasproviders API is being redone to easily create providers outside of the augeasproviders module. See the shellvar standalone provider (PoC for now, the API will probably work this way eventually) for example.

Alternatively, if you just want to use the augeas type instead of writing a provider (which I would recommend though), you can just write a fact and use it in Puppet DSL to avoid declaring the augeas resource when sysvinit is not installed.

share|improve this answer

A horrible alternative would be to ditch the augeas resource type for an exec resource running augtool, and checking for the package in an onlyif command.

I'd go with the custom fact.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.