jps-help / puppet-netplan

Puppet module to manage netplan
Apache License 2.0
0 stars 0 forks source link

lookup_options example and couple of other suggestions #6

Closed loood closed 10 months ago

loood commented 12 months ago

Hi! Thanks for making this module. Couple of thoughts

  1. The only thing I did which might be a good example to add to your docs is to show how to use this with lookup_options. Mainly cause I wanted to reduce the amount of copy and paste. See examples below.
  2. Possible to sort the output of the to_yaml?
  3. Anyway to deal/accept zero padded priority? ie 00 01 ..09. which follows how ubuntu's numbering scheme.
  4. Possible to add a header to the generated netplan config(s) with # this file is managed by puppet or equivalent ?
$ cat data/common.yaml
lookup_options:
  netplan::configs:
    merge: 'deep'
$ cat data/virtual/physical.yaml
netplan::configs:
  installer-config:
    settings:
      bonds:
        lan0:
          dhcp-identifier: mac
          dhcp4: true
          interfaces: [mlnx]
          parameters:
            lacp-rate: fast
            mii-monitor-interval: 100
            mode: 802.3ad
            transmit-hash-policy: layer3+4
      ethernets:
        mlnx:
          dhcp4: false
          match:
            driver: mlx5_core
      renderer: networkd
      version: 2
cat data/manufacturer/supermicro.yaml
netplan::configs:
  redfish:
    settings:
      ethernets:
        redfish0:
          dhcp4: true
          match:
            macaddress: b0:3a:f2:b6:05:9f
          set-name: redfish0
          optional: true
      renderer: networkd
      version: 2
jamesps-ebi commented 11 months ago

The documentation change is a good addition and easy to add.

The to_yaml function doesn't have a sort function of its own. But if I understand correctly it generates the resultant YAML in the same order it receives the data. So you might be able to use the following lookup functionality to sort your YAML: https://www.puppet.com/docs/puppet/7/hiera_merging.html#merge_behaviors I'm reluctant to add this as a feature, since the end result is the same regardless of sorting and my primary purpose with this module was simplicity.

The header and priority might be possible but I need to look into it further. They might introduce some breaking change.

jps-help commented 10 months ago

Features addressed in new release v2.0.0