Ask Your Question
0

Is it possible to use Hiera Knockout Rules for Hashes?

asked 2016-12-21 18:49:24 -0600

jack9 gravatar image

common.yaml:

lookup_options:
  firewall::rules: { merge: {strategy: deep, merge_hash_arrays: true, knockout_prefix: "--", sort_merge_arrays: true}}

firewall::rules
    http_allow:  { action: 'ACCEPT', proto: 'tcp', source: 'net', dest: '$FW', port: '80', order: '50', comment: 'http access'  }
    ssh_all: { action: 'ACCEPT', proto: 'tcp', source: 'net', dest: '$FW', port: '22', sport: '-', original_dest: '-', order: '50', comment: 'all ssh access'  }

example.com.yaml:

firewall::rules
    --ssh_all:
    ssh_admins: { action: 'ACCEPT', proto: 'tcp', source: 'net:123.456.768', dest: '$FW', port: '22', sport: '-', original_dest: '-', order: '50', comment: 'admin ssh access'  }

should result in a merged yaml:

firewall::rules
    http_allow:  { action: 'ACCEPT', proto: 'tcp', source: 'net', dest: '$FW', port: '80', order: '50', comment: 'http access'  }
    ssh_admins: { action: 'ACCEPT', proto: 'tcp', source: 'net:123.456.768', dest: '$FW', port: '22', sport: '-', original_dest: '-', order: '50', comment: 'admin ssh access'  }
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-10-05 08:33:49 -0600

nb gravatar image

Knockout is string prefix to indicate a value which should be removed from the final result.

In his example you are apply the prefix to a key, Puppet then see the keyname as "--ssh_all"

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: 2016-12-21 18:49:24 -0600

Seen: 102 times

Last updated: Dec 21 '16