0

I have the following Puppet module:

class resolvconf { $packages = ['resolvconf', 'dnsmasq'] package { $packages: ensure => installed, } file { '/etc/resolvconf/resolv.conf.d/base': ensure => file, owner => root, group => root, content => ' nameserver 127.0.0.1 nameserver 8.8.8.8 nameserver 8.8.4.4', } service { 'dnsmasq': require => Package[resolvconf], ensure => running, subscribe => File['/etc/resolvconf/resolv.conf.d/base'] } } 

However, when I run the provisioning, I get the following error:

err: /Stage[main]/Resolvconf/File[/etc/resolvconf/resolv.conf.d/base]/ensure: change from absent to file failed: Could not set 'file on ensure: No such file or directory - /etc/resolvconf/resolv.conf.d/base.puppettmp_4012 at /tmp/vagrant-puppet/modules-0/resolvconf/manifests/init.pp:13

I understand this to mean that /etc/resolvconf/resolv.conf.d/base does not exist yet, or can't be created. This problem seems to eventually go away after a number of re-provisionings or a reboot, so it would seem to be some sort of a dependency problem that I could resolve with the appropriate dependency or exec statement.

In addition, because of this failed dependency, the following will hang indefinitely:

notice: /Stage[main]/Resolvconf/Service[dnsmasq]: Dependency File[/etc/resolvconf/resolv.conf.d/base] has failures: true warning: /Stage[main]/Resolvconf/Service[dnsmasq]: Skipping because of failed dependencies 

or at least until I hit CTRL-C.

What do I need to change in the module or manifest to allow the script to run correctly the first time through?

1 Answer 1

1

Add a line to require the package in your file resource like this:

file { '/etc/resolvconf/resolv.conf.d/base': ensure => file, owner => root, group => root, content => '... require => Package['resolvconf'], } 

Using a require basically forced puppet to perform the package install first.

This of course assumes that the installation of the resolvconf package creates the required directories, which I believe it does happen.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.