How can i execute a single class from my puppet manifest file?

0 votes
I have a manifest file that's a bit huge. Is there anyway that i can run a single class from the manifest file?
Aug 6 in Puppet by Mishti
28 views

1 answer to this question.

0 votes

You can execute a subset of resources with the --tags argument. However, you first have to set the associated tag in the resources you want executed for that tag. 

If you wanted to execute only one class, then you can set a tag for that class and specify that tag as the argument to --tags to execute only that class.

 you could refer to: https://docs.puppet.com/puppet/4.10/lang_tags.html

In this case, the tag function will be much more useful for you than the metaparameter.

https://docs.puppet.com/puppet/4.10/lang_tags.html#the-tag-function

# You can use the tag function inside a class definition or defined type to assign tags to the surrounding container and all of the resources it contains
class myClass {
  tag 'mytag'
  ...
}

You can then execute only myClass:

# execute agent with tags
puppet agent -t --tags mytag

https://docs.puppet.com/puppet/4.10/lang_tags.html#restricting-catalog-runs

answered Aug 6 by Sirajul
• 35,810 points

Related Questions In Puppet

0 votes
1 answer

Puppet+Docker: How do i configure my docker container to use a NFS volume through a Hiera config file?

If using Hiera, configure the docker::volumes class in the ...READ MORE

answered Aug 14 in Puppet by Sirajul
• 35,810 points
30 views
0 votes
1 answer

How can i check the requests of certificates from puppet agent to puppet master?

You could do this by executing the ...READ MORE

answered Jul 24 in Puppet by Sirajul
• 35,810 points
77 views
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
204 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Puppet: How many slave nodes can i configure with a single puppet master?

Open source Puppet doesn't have any kind ...READ MORE

answered Aug 9 in Puppet by Sirajul
• 35,810 points
31 views