Is this a good practise?

asked 2018-03-08 10:04:41 -0500

SundarKid gravatar image

updated 2018-03-09 02:56:13 -0500

I plan on creating define resources in a particular module, and use the defined resources in other modules for easier development and removing redundancy of code definition.

We have a requirement of creating a list of files and executing a set of commands that is common in some modules. So I plan on creating a defined resource for that sequential operation which can be used by my teammates later for their modules.

The ultimate plan is to create a huge number of defined resource and use it in other modules for easier and consistent code.

There are two plans, that I came up with,

  1. Have 5 or 6 Generic puppet modules with define resources grouped in each puppet module.
  2. Have one Generic Puppet Module and have all the defined resources in it and use them in other modules as we write customized code.

Which is the best option.

I have one puppet master with foreman managing the hostgroup classification.

There may be as much as 3k puppet agents contacting the master for modules, every one hour at some point of time due to dynamic provisioning of hosts.

Which of the above 2 is a good strategy? If both are not is there a different way to proceed for more generic resource creation?

More Details

Current setup: 120 hostgroups in foreman 2.9K~ agents checking with master every hour We are planning to create a setup where we control most of the system configs in puppet and hiera, so when a host goes down we can rebuild the host back faster with puppet and hiera.

Hiera for hosts is managed by a tool for changes. All our host apps are for providing microservices. We sysadmins want to manage the packages and configs with hiera only, so we can build identical hosts from config details from hiera (Minimal human intervention in change of configs in hosts) faster provisioning when needed.

We have limited infra, so we came up with this plan to provision identical hosts during peak load and decom them later.

Code plan details: use case:

process 1 has a series of steps process 2 has series of steps

In process 1: step 5 has 3 operations In process 2: step 2 has 3 operations

Which are the same. So I thought we can have define resource to do that 3 operations in a separate gen-module and call in both modules of process 1 and 2.

So the max gen-define-resources ops I could come up with is around 21 now.

Current max modules on a host group is around 20.

edit retag flag offensive close merge delete

Comments

Modularize as much as possible, as less as necessary. A module shall serve a well demarcated task. However, the general strategy is questionable. “Create a huge number of defined resource[s]” , yeah, that's gonna slow down catalog compilation. Since I don't know what u'r doing, I can't advise furthr

Kai Burghardt gravatar imageKai Burghardt ( 2018-03-08 18:05:32 -0500 )edit

Current setup: 120 hostgroups in foreman 2.9K~ agents checking with master every hour We are planning to create a setup where we control most of the system configs in puppet and hiera, so when a host goes down we can rebuild the host back faster with puppet and hiera.

SundarKid gravatar imageSundarKid ( 2018-03-09 01:00:01 -0500 )edit

Hiera for hosts is managed by a tool for changes. All our host apps are for providing microservices. We sysadmins want to manage the packages and configs with hiera only, so we can build identical hosts from old config details from hiera (Minimal human intervention in change of configs in hosts)

SundarKid gravatar imageSundarKid ( 2018-03-09 01:03:21 -0500 )edit

I have edited and provided more details

SundarKid gravatar imageSundarKid ( 2018-03-09 02:56:29 -0500 )edit