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, 2019 in Puppet by Mishti
2,375 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, 2019 by Sirajul
• 59,230 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, 2019 in Puppet by Sirajul
• 59,230 points
925 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, 2019 in Puppet by Sirajul
• 59,230 points
2,997 views
0 votes
1 answer

Puppet: Can i automatically generate puppet manifests from a puppet server?

Yes, here is how you can do ...READ MORE

answered Aug 7, 2019 in Puppet by Sirajul
• 59,230 points
720 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,024 views
+2 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, 2019 in Puppet by Sirajul
• 59,230 points
1,038 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP