Hi,
anyone managed to get a working setup based on hiera with mysql
backend? Here is the link to howto I followed:
http://www.craigdunn.org/2012/03/introducing-hiera-mysql-mysql-backend-for-hiera/
I''ve tried it but got problems – %{key} seems to be empty in SQL query
when puppet does hiera lookup. Here is the query from hiera.yaml
config file:
:query: SELECT val FROM nodes WHERE var=’%{key}’ AND server=’%{fqdn}’
Table nodes structure:
CREATE TABLE `nodes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server` varchar(255) DEFAULT NULL,
`var` varchar(255) DEFAULT NULL,
`val` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
When I do hiera lookup from the command line it works just fine:
#hiera -c /etc/puppet/hiera.yaml owner fqdn=cluster2.int
tester
But when I run “puppetd -t” on the cluster2.int server I get this:
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not find data item owner in any Hiera data file and no
default supplied at /etc/puppet/modules/apache/manifests/init.pp:3 on
node cluster2.int
Line 3 in /etc/puppet/modules/apache/manifests/init.pp is:
$owner = hiera(‘owner’)
For debug purpose I’ve changed SQL query to the following:
:query: SELECT val FROM nodes WHERE var=%{key} AND server=’%{fqdn}
START%{key}END’
That’s what I got then:
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ‘AND server=’cluster2.int STARTEND” at line 1 at /etc/puppet/
modules/apache/manifests/init.pp:3 on node cluster2.int
So as you can see %{key} is empty in the SQL query ( ’%{fqdn} START%
{key}END’ tuns into "cluster2.int STARTEND").
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.