Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not add pe.conf data to PE node group #15

Open
bastelfreak opened this issue Apr 5, 2024 · 0 comments
Open

Do not add pe.conf data to PE node group #15

bastelfreak opened this issue Apr 5, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@bastelfreak
Copy link

bastelfreak commented Apr 5, 2024

Use Case

the pe-installer can take a pe.conf from a user. The data will be added to a node group. I think this is bad because there's no easy way to change the data afterwards. I think the least painful way of changing the data would be custom puppet resource types. The data cannot be overwritten by hiera because the PE console has a higher significance. Also it's not intuitive for the user that the data is added to a node group. It's hard to find, not well documented and people don't know that it's hard to change afterwards until they have to change it.

Describe the Solution You Would Like

I think the data from pe.conf should be used on a global hiera level, but it should not be added to a node group. That just adds another layer of complexity and it's hard to clean it up or change it in an automated way. Manipulate or delete local yaml or json files in the hiera level is way way easier.

Describe Alternatives You've Considered

https://github.com/WhatsARanjit/puppet-node_manager can be used to clean up the data. But I think the better solution is to avoid the data in the node groups in the first place.

$group = 'PE Master'
$data = dig(node_groups($group))[$group]
$classes = dig($data, 'classes')
if $classes {
  if dig($classes, 'puppet_enterprise::profile::master', 'r10k_remote') {
    $master = { 'puppet_enterprise::profile::master' => $classes['puppet_enterprise::profile::master'] - 'r10k_remote' }
    $new_classes = $classes + $master
    node_group { $group:
      classes        => $new_classes,
      purge_behavior => 'classes',
      # purge read only attributes + classes
      *              => $data - ['environment_trumps', 'last_edited', 'serial_number', 'config_data', 'id','classes',],
    }
  } else {
    echo {"r10k_remote not set in node group ${group}":
      withpath => false,
    }
  }
} else {
  echo { "no classes hash in node group ${group}":
    withpath => false,
  }
}

Additional Context

This is based on a slack conversation that started at https://puppetcommunity.slack.com/archives/CFD8Z9A4T/p1712265507861729

@bastelfreak bastelfreak added the enhancement New feature or request label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant