Ask Your Question
0

Arrays and hiera data

asked 2017-02-03 12:24:10 -0500

Red Cricket gravatar image

Hi,

I am trying to reorganize a large monolithic hiera data file. What I have been doing is this:

controller_node_ips: &CONTROLLER_NODE_IPS
  - 10.29.103.28
  - 10.29.103.29
  - 10.29.103.30
.
.
.
galera::bind_address: "%{::ipaddress}"
galera::status_password: 'status_password'
galera::galera_servers: *CONTROLLER_NODE_IPS
galera::configure_repo: false
galera::galera_master: "%{hiera('galera_master')}"
galera::root_password: 'XXXX123'
galera::vendor_type: 'IT'
galera::override_options:
   mysqld: 
      'max_connections': 9000
galera::validate::host: 'localhost'

I tried to move the galera parameters to their own file, galera.yaml, so I couldn't use the reference *CONTROLLER_NODE_IPS. My galera.yaml looks like this:

---
galera::bind_address: "%{::ipaddress}"
galera::status_password: 'status_password'
galera::galera_servers: "%{hiera('controller_node_ips')}"
galera::configure_repo: false
galera::galera_master: "%{hiera('galera_master')}"
galera::root_password: 'XXXX123'
galera::vendor_type: 'IT'
galera::override_options:
   mysqld:
      'max_connections': 9000
galera::validate::host: 'localhost'

I can run this on the puppet master.

# hiera galera::galera_servers "::prefix=svl-ost-kilo"
["10.29.103.28", "10.29.103.29", "10.29.103.30"]

but on my puppet agent node I get this error:

Error while evaluating a Function Call, join(): Requires array to work with at /etc/puppetlabs/code/environments/production/modules/galera/manifests/params.pp:6:17 on node
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2017-02-06 08:04:04 -0500

DarylW gravatar image

Via the docs, you may be looking for the 'alias' command.

https://docs.puppet.com/hiera/3.2/var...

The alias() lookup function

The alias() function allows you to make one key in Hiera data act as an alias for another. This is different than just interpolating another key, since that results in a string.

original:
  - 'a'
  - 'b'
aliased: "%{alias('original')}"

This returns an array with ['a', 'b'] for both the original and the aliased keys.

The data entry that uses the alias function cannot combine it with post/prefix text — that is, aliased: "%{alias('original')} -c" would be an illegal value.

edit flag offensive delete link more
0

answered 2017-02-03 14:32:17 -0500

puser gravatar image

Without more information I would guess that galera::galera_servers is not getting set properly on your agent. I would do a compare of the facts from both servers and see what you get back. Also add a notify for whatever is in params.pp that you are trying to join.

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: 2017-02-03 12:24:10 -0500

Seen: 88 times

Last updated: Feb 06