9

I am using Vagrant to jump start some initial Puppet config and am confused on how to include/run multiple manifests (other than just site.pp) in the puppet execution workflow without making the extra manifests into modules and including them that way.

In the puppet manifests directory that I point Vagrant to (see below) I have two manifests that I want executed: site.pp and hierasetup.pp.

config.vm.provision "puppet" do |puppet|
  puppet.manifests_path = "puppet_files/manifests"
  puppet.module_path    = "puppet_files/modules"
  puppet.manifest_file  = "site.pp"
  puppet.options = "--verbose --debug"
end 

Currently I am having site.pp be the manifest that calls hierasetup.pp. My site.pp looks like this:

File {
  owner => 'root',
  group => 'root',
  mode  => '0644',
}

import "hierasetup.pp"

include jboss

But I get this error about the deprecation of "import":

Warning: The use of 'import' is deprecated at /tmp/vagrant-puppet-1/manifests/site.pp:33. See http://links.puppetlabs.com/puppet-import-deprecation (at grammar.ra:610:in `_reduce_190')

According to the referenced URL under "Things to try instead" it says "To keep your node definitions in separate files, specify a directory as your main manifest".

Further this puppet doc on main manifests says:

"Recommended: If you’re using the main manifest heavily instead of relying on an ENC, consider changing the manifest setting to $confdir/manifests. This lets you split up your top-level code into multiple files while avoiding the import keyword. It will also match the behavior of simple environments."

It appears that Puppet can reference an entire directory instead of just a specific manifest file, such that I would expect that Vagrant would make a provision for this and allow me to drop the "puppet.manifest_file = "site.pp" line and point to the parent directory instead in which all the *.pp files there will be executed. However removing that line in Vagrant merely generates a complaint about an expected "default.pp" in its stead:

puppet provisioner: * The configured Puppet manifest is missing. Please specify a path to an existing manifest: /some/path/puppet_files/manifests/default.pp

So:

  1. Firstly, do I understand the "new" (non-import) way of calling multiple manifests correctly, in that a directory is to be pointed to in which all the *.pp files inside it will be executed?
  2. And secondly, has Vagrant "caught up" with this new change to accommodate the referencing of directories in conjunction with Puppet's deprecation of "import"?

Update: Thanks to Shane the issue with #2 (Vagrant's code not being caught up to allow pointing to puppet manifest directories) was reported on Vagrant's GitHub issue tracker site and has since been patched: https://github.com/mitchellh/vagrant/issues/4169

6

Firstly, do I understand the "new" (non-import) way of calling multiple manifests correctly, in that a directory is to be pointed to in which all the *.pp files inside it will be executed?

Yes, you do. See here:

If you’re using the main manifest heavily instead of relying on an ENC, consider changing the manifest setting to $confdir/manifests. This lets you split up your top-level code into multiple files while avoiding the import keyword.

Moreover, manifest and modulepath are also getting deprecated in favor of directory environments and the manifest directory behavior, see here:

Now that directory environments are completed, config-file environments are deprecated. Defining environment blocks in puppet.conf will cause a deprecation warning, as will any use of the modulepath, manifest, and config_version settings in puppet.conf.

This is a pretty big change for a lot of deployments, but should be a good improvement in the long run.


And secondly, has Vagrant "caught up" with this new change to accommodate the referencing of directories in conjunction with Puppet's deprecation of "import"?

No, it has not; from their docs:

manifest_file (string) - The name of the manifest file that will serve as the entrypoint for the Puppet run. This manifest file is expected to exist in the configured manifests_path

For use with Vagrant, you're stuck with dealing with deprecation warnings for now, which is unfortunate. But, import's not slated for removal until 4.x, so this gives Vagrant some time to catch up.

  • Well, its good to know that I'm not going crazy because I've been trying to figure out what the deal was for over an hour now. Are the Vagrant developers aware of the need for that feature, or if not is there a place to suggest such additions? – SeligkeitIstInGott Jun 13 '14 at 21:45
  • Looks like it hasn't yet been asked of them - see here. Drop an issue in there to get it aligned better with modern puppet (or I'll do it if you don't have a github account)! – Shane Madden Jun 13 '14 at 21:48
  • I think my development coworkers all have github accounts, but if I have one I don't even know what my login would be. I have no need for one since I'm IT and not a coder. Would you mind terribly doing that? – SeligkeitIstInGott Jun 13 '14 at 22:23
  • 1
    @SeligkeitIstInGott Sure thing, I'll get something filed! – Shane Madden Jun 13 '14 at 22:25
  • 2
    @SeligkeitIstInGott Done - github.com/mitchellh/vagrant/issues/4039 – Shane Madden Jun 13 '14 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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