Search code examples
puppet

Howto pass ENC parameters to a puppet apply run?


To test my puppet modules I usually just use puppet apply on a virtual machine. In that testing scenario there is no puppet master or ENC available.

Lot's of my modules use parameters. So how do I test the module with different parameters without the need to hardcode them?


Solution

  • You need to include the class with parameters as you would in a manifest, e.g.

    class { 'foo':
      param1 => 'value',
    }
    

    puppet apply can take a manifest either as an argument to -e, in a file or on stdin, so you could run:

    puppet apply -e "class { 'foo': param1 => 'value', param2 => 'value2' }"
    

    or put the class { 'foo': ... } into test.pp and run puppet apply test.pp.

    Or lastly, run puppet apply, type/paste the class { 'foo': ... } content into stdin and press Ctrl+D to end input and run it.