Hiera error-could not initialize global default settings
Greetings good people,
I'm very new to puppet who literally have only 3 days of experience. I have been following this great course "Puppet Fundamentals for System Administrators by "Pluralsight" and trying out everything exactly what the instructor say whcih worked perfectly so far but unfortunately I cant seem to get my hiera configurations right. :( I get the below error when I run "puppet --verbose --no-daemonize --onetime" from corresponding agents.
[root@box2 ssl]# puppet --verbose no-daemonize --onetime -Error: Could not initialize global default settings: Error parsing arguments Wrapped exception: invalid argument syntax: '--' [root@box2 ssl]
What I'm trying to do here is to deploy a fresh "mediawiki" site on 2 clients via puppet. Note that in puppet master I have successfully installed passenger and apache. Also note that the whole deployment of mediawiki on 2 clients worked flawlessly when hiera was not used. Following is my setup.
- puppetmaster - box1.mylab.jazz
- agent 1 - box2.mylab.jazz
- agent 2 - box3.mylab.jazz
a) Below is an extract from "/etc/puppet/puppet.conf" file.
dns_alt_names = box1,box1.mylab.jazz
[master]
environmentpath = $confdir/environments
basemodulepath = $confdir/modules:/opt/puppet/share/modules
[agent]
classfile = $vardir/classes.txt
localconfig = $vardir/localconfig
b) Below is an the "/etc/puppet/environments/production/manifests/nodes.pp"
node 'box2.mylab.jazz' {
hiera_include('classes')
}
node 'box3.mylab.jazz' {
hiera_include('classes')
}
class linux {
file { '/info.txt':
ensure => 'present',
content => inline_template("created by puppet at <%= Time.now %>\n"),
}
$admintools = ['git', 'nano', 'screen']
package { $admintools:
ensure => 'installed',
}
service { 'ntpd':
ensure => 'running',
enable => true,
}
}
c) below is the manifest of mediawiki module on "/etc/puppet/environments/production/modules/mediawiki/manifests/init.pp" NOTES: The variables mentioned (prefixed with "$wiki") on the very top of this file are meant for a php file that is required by mediawiki on all agents.
class mediawiki {
$wikimetanamespace = hiera('mediawiki::wikimetanamespace')
$wikisitename = hiera('mediawiki::wikisitename')
$wikiserver = hiera('mediawiki::wikiserver')
$wikidbserver = hiera('mediawiki::wikidbserver')
$wikidbname = hiera('mediawiki::wikidbname')
$wikidbuser = hiera('mediawiki::wikidbuser')
$wikidbpassword = hiera('mediawiki::wikidbpassword')
$wikiupgradekey = hiera('mediawiki::wikiupgradekey')
$phpmysql = $osfamily ? {
'redhat' => 'php-mysql',
'debian' => 'php5-mysql',
'default' => 'php-mysql',
}
package { $phpmysql:
ensure => 'present',
}
if $osfamily == 'redhat' { ##running a condition. insatll phpxml only on redhat based
package { 'php-xml':
ensure => 'present',
}
}
class { '::apache':
docroot => '/var/www/html',
mpm_module => 'prefork',
subscribe => Package[$phpmysql], ##metaparameter. 2 things it does. if phpmysql package ever changes puppet will restart httpd. make sure myphp is installed before apache
}
class { '::apache::mod::php':} ##"::" is top scope which tells pup to look for apache class instead of our classes, modules.
class { '::mysql::server':
root_password => 'redhat',
}
file { 'LocalSettings.php':
path => '/var/www/html/LocalSettings.php',
ensure => 'file',
content => template('mediawiki/LocalSettings.erb'),
}
}
c). hiera config file "/etc/puppet/hiera.yaml"
:backends:
- yaml
:yaml:
:datadir:
:hierarchy:
- "%{clientcert}"
- boxdefault
:logger: console
d). hiera resource files under "/var/lib/hiera/"
> [root@box1 hiera]# ls -ltr
> /var/lib/hiera/
>
> -rw-r--r-- 1 root root 135 Nov 26 20:17 boxdefault.yaml
> -rw-r--r-- 1 root root 186 Dec 1 10:21 box3.mylab.jazzyaml
> -rw-r--r-- 1 root root 173 Dec 1 14:35 box2.mylab ...