Search code examples
vagrantpuppetprovisioning

Puppet module developer workflow with vagrant


I'm currently working on developing a custom module for Puppet. That is my first Puppet module, I'm following tutorials and documentation here

https://www.digitalocean.com/community/tutorials/getting-started-with-puppet-code-manifests-and-modules https://docs.puppetlabs.com/guides/module_guides/bgtm.html https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html https://docs.puppetlabs.com/guides/module_guides/bgtm.html

My setup is the following:

  1. I picked the basic configuration from puphpet.com
  2. Provisioned the instance with vagrant locally
  3. Added new module to the modules folder and working on that module.

What slows development is that I have to run the full provisioning every time to see how changes to my module work with vagrant provision --provision-with puppet. Or I can run simple instruction from my module like puppet apply <path-to-simple-pp-file>.

But that looks not effective, I'd like to just call part of provisioning related to my module, i.e. call apply for my module only. Is there a way to do that? It looks like something too obvious that it is not mentioned anywhere or I don't know what should I search for.

My question is: how do I re-run application/provisioning of one single module among all the other modules available in current puppet config.

UPDATE: I'm not using client/server puppet, or at least I think I'm not using it. And not going to use. Plan is to have instance provisioned with vagrant + puppet, but without any remote puppet server.

UPDATE2: here is the listing of my puppet modules

#ls -la /vagrant/puphpet/puppet/modules
 apache
 apt
 beanstalkd
 blackfire
 composer
 concat
 elasticsearch
 epel
 erlang
 firewall
 git
 inifile
 java
 LICENSE
 locales
 mailcatcher
 mongodb
 monitor
 mysql
 nginx
 ntp
 php
 postgresql
 puphpet
 puppi
 pyenv
 rabbitmq
 README.md
 redis
 rvm
 solr
 staging
 stdlib
 supervisord
 swap_file
 sw_mage_deploy *the one I'm working on*
 sysctl
 vcsrepo
 yum

Solution

  • Lets say you have your modules installed like:

    • /etc/puppet/module/apache/manifests...
    • /etc/puppet/module/java/manifests...
    • /etc/puppet/module/mycustommodule/manifests...

    You can use tags to run one or multiple modules only:

    sudo puppet agent --test --tags=mycustommodule
    sudo puppet agent --test --tags=java,mycustommodule
    

    To run puppet locally and apply a specific module, you can

    sudo puppet apply --debug --verbose --trace --modulepath /etc/puppet/module -e "include mycustommodule"