Find out what the Bolt team is working on and why we're making the decisions we're making.
September 2020
Module management in Bolt projects
We've recently finished work on a major improvement to Bolt projects: module management! With this improvement, you no longer need to manually manage your modules and their dependencies in a Puppetfile and can instead automate that process with Bolt.
If you want to try it out, create a project or migrate an existing project with the following command:
*nix shell command
bolt project migrate
PowerShell cmdlet
Update-BoltProject
Why are we making these changes?
So why did we make this change to how Bolt manages modules? Because managing a project's modules could be a frustrating process that includes multiple steps:
-
Find the module you want to add to your project
-
Find all of the dependencies for that module
-
Determine which version of each module is compatible with every other module you have installed
-
Manually update your Puppetfile to include each module
-
Install the Puppetfile
By offloading most of this work to Bolt, you now only need to list the modules you care about in your project configuration. Bolt takes care of resolving a module's dependencies and installing compatible versions. This greatly simplifies the process of managing your project's modules:
-
Find the module you want to add to your project
-
Tell Bolt to install the module with all of its dependencies
With these changes, we've also updated where Bolt installs modules. You no longer need to worry about accidentally overwriting local modules when you install a Puppetfile, because Bolt installs modules to a special directory that is not part of the configured modulepath.
The new module management feature is available starting with Bolt 2.30.0. To try it out, create a project or migrate an existing project.
Here's a summary of what's changed:
-
Managed module installation directory: Bolt now installs modules it manages into the
.modules/
directory instead ofmodules/
. Avoid committing.modules/
to source control. Your users can download your Bolt project and use thebolt module install
*nix shell command, orInstall-BoltModule
cmdlet to download the required modules. -
Non-managed module directory: Bolt no longer uses the
site-modules/
directory. Store any modules that you don't want Bolt to manage in themodules/
directory. -
Module configuration: Your
bolt-project.yaml
file contains amodules
key that lists the direct module dependencies of your Bolt project. Unless you need to pin a module to a specific version, avoid editing themodules
list directly. Instead, use thebolt module add
command. -
Puppetfile: The Puppet file is now a lock file. Bolt generates a Puppetfile each time you modify your modules with a Bolt command. Do not edit the Puppetfile directly. Instead, use Bolt commands to manage your modules, and rely on Bolt to manage the Puppetfile. You can compare a Puppetfile to a Gemfile.lock file in Ruby, or a yarn.lock file in Yarn.
-
modulepath: The new modulepath is
['modules']
and Bolt always appends.modules
to the modulepath.
Comments
0 comments
Please sign in to leave a comment.