Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Submodules in puppet?

Tags:

puppet

Can you make submodules in puppet, for instance have...

puppet_root
  - modules
    - module_1
      - submodule
        - manifests
          - init.pp

I've tried this and puppet doesn't seem to like it. I could change my submodule init.pp's into more descriptive filenames and get rid of the directories all together but some of the modules have more than one file and that will clutter things up.

The reason I'm doing this is to put all of the OS tools together into one "super" module, so it can be more self-documenting: eg. os_tools::lsof, etc.

like image 387
creftos Avatar asked Mar 23 '23 22:03

creftos


1 Answers

puppet structure goes like this :

/etc/puppet/modules/modulename/manifests/init.pp
class modulename{ 
   -----
}

submodule1 and submodule2 can be directories inside /etc/puppet/modules/modulename/manifests/

and each of them can contain .pp files. for example:

/etc/puppet/modules/modulename/manifests/submodule1/foo.pp
class modulename::submodule1::foo{
 notify{"I am in modulename->submodule1->foo":}
}

You can include the class like this:

include modulename::submodule1::foo
like image 141
iamauser Avatar answered Apr 27 '23 22:04

iamauser