Ask Your Question
0

How to add stages to ENC received classes?

asked 2019-01-09 10:37:50 -0600

Ji1990 gravatar image

I have many Puppet modules in my test environment placed in:

/etc/puppetlabs/code/environments/test/

The ENC is sending a YAML to puppet with Class/Parameter/Environment information for a specific server.

Example:

classes:

    class1:
    class2:
    class3:
        parameter3: value3
    class4:
        parameter4:
            - value41
            - value42
    ...
environment: test

This information is put in the node scope according to this article.

Is there a way to specify run stages where I can say first apply the classes in run stage 'first', then the classes in run stage 'second' etc... while also respecting the received information from the ENC.

My puppet modules are defined with namespaces where each .pp file handles 1 class and inherits parameters from a parameters.pp file.

I can modify them if needed. I can also upgrade puppet to version 6.1 if that helps.

Puppet Version: 4.10

Open Source Puppet

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-10 06:49:32 -0600

Ji1990 gravatar image

Adding a node 'my_node' to the main manifest 'site.pp' with the following content:

node 'my_node' {
  class { 'class2':
    stage => 'first'
  }
}

Results in:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Duplicate declaration: Class[class2] is already declared in file /etc/puppetlabs/code/environments/test/manifests/site.pp:19; cannot redeclare on node my_node.

Merging doesn't work very well between Puppet and the ENC.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-01-09 10:23:49 -0600

Seen: 175 times

Last updated: Jan 10