Can Vagrant point to a directory of Puppet manifests for execution?
- by SeligkeitIstInGott
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:
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?
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