Last active
August 29, 2015 14:26
-
-
Save AAlvz/9bd684c50ca056ca5c30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################## | |
# Directory structure on puppetmaster (/etc/puppet) | |
################################## | |
hieradata | |
│ ├── development | |
│ │ ├── agent.yaml | |
│ │ ├── hosts.yaml | |
│ │ └── puppetmaster.yaml | |
│ └── production | |
│ ├── hosts.yaml | |
│ └── puppetmaster.yaml | |
hiera.yaml | |
puppet.conf | |
manifests | |
│ └── site.pp | |
̣environments/ | |
├── development | |
│ ├── environment.conf | |
│ └── modules | |
│ ├── base | |
│ │ └── manifests | |
│ │ └── init.pp | |
│ └── puppetmaster | |
│ └── manifests | |
│ └── init.pp | |
######################## | |
# Master puppet.conf | |
######################## | |
[main] | |
certname=puppetmaster | |
logdir=/var/log/puppet | |
vardir=/var/lib/puppet | |
ssldir=/var/lib/puppet/ssl | |
rundir=/var/run/puppet | |
factpath=$vardir/lib/facter | |
prerun_command=/etc/puppet/etckeeper-commit-pre | |
postrun_command=/etc/puppet/etckeeper-commit-post | |
user=puppet | |
group=puppet | |
environmentpath=$confdir/environments | |
basemodulepath=/etc/puppet/modules | |
#environment_timeout = unlimited #for better performance | |
[master] | |
certname=puppetmaster | |
dns_alt_names = puppetmaster01,puppetmaster01.dominio.com | |
ssl_client_header = SSL_CLIENT_S_DN | |
ssl_client_verify_header = SSL_CLIENT_VERIFY | |
reports=store,http | |
####################################################### | |
# Agent puppet conf | |
####################################### | |
[main] | |
logdir=/var/log/puppet | |
vardir=/var/lib/puppet | |
ssldir=/var/lib/puppet/ssl | |
rundir=/var/run/puppet | |
factpath=$vardir/lib/facter | |
prerun_command=/etc/puppet/etckeeper-commit-pre | |
postrun_command=/etc/puppet/etckeeper-commit-post | |
user=puppet | |
group=puppet | |
server=puppetmaster | |
[master] | |
ssl_client_header=SSL_CLIENT_S_DN | |
ssl_client_verify_header=SSL_CLIENT_VERIFY | |
[agent] | |
report=true | |
graph=true | |
runinterval=10m | |
######################### | |
# environments/development/environment.conf | |
########################### | |
modulepath = modules | |
############################ | |
# /etc/puppet/environments/development/modules/puppetmaster/manifests/init.pp | |
############################ | |
class puppetmaster { | |
$hosts = hiera('hosts', {}) | |
create_resources(host, $hosts) | |
file {'/etc/puppet/puppet.conf': | |
source => 'puppet:///modules/puppetmaster/puppet.conf.master', | |
notify => Service['puppetmaster'], | |
} | |
service {'puppetmaster': | |
ensure => running, | |
enable => true, | |
} | |
} | |
############## | |
# /etc/puppet/hiera.yaml | |
################## | |
--- | |
:backends: | |
- yaml | |
:yaml: | |
:datadir: /etc/puppet/hieradata | |
:hierarchy: | |
- "%{::environment}/%{::hostname}" | |
- "%{::environment}/hosts" | |
############################ | |
# /etc/puppet/hieradata/development/puppetmaster.yaml | |
############################ | |
--- | |
classes: | |
- puppetmaster | |
############################## | |
# The error | |
############################## | |
Error: Could not find class puppetmaster for puppetmaster on node puppetmaster | |
Error: Could not find class puppetmaster for puppetmaster on node puppetmaster# | |
############################### | |
# Testing | |
###############################3 | |
On master | |
user@puppetmaster$ sudo puppet apply manifests/site.pp --environment development | |
Error: Could not find class puppetmaster for puppetmaster on node puppetmaster | |
On agent it doesn't apply any configuration. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment