I recently changed a puppet environment to use environment directories and since this is on Solaris I made some notes. I do not include any puppet master or agent setup here only the changes I made to enable directory environments.
https://docs.puppet.com/puppet/3.7/environments\_configuring.html
Since this is Solaris and using SMF we can’t just edit puppet.conf
# svccfg -s svc:/application/puppet:master setprop config/environmentpath=/etc/puppet/environments# svcadm refresh puppet:master# svcadm restart puppet:master
root@usli-utility:/etc/puppet/environments/dev/manifests# more /etc/puppet/puppet.conf# WARNING: THIS FILE GENERATED FROM SMF DATA.# DO NOT EDIT THIS FILE. EDITS WILL BE LOST.## See puppet.conf(5) and http://docs.puppetlabs.com/guides/configuring.html# for details.[master]environmentpath = /etc/puppet/environmentslogdest = /var/log/puppet/puppet-master.logserver = puppetmaster.domain.comTake a look at the structure.
# pwd
/etc/puppet/environments
# tree
.
|— dev
| |— environment.conf
| |— manifests
| | |— site.pp
| | |— node-eb31.pp
| | |— node-eb32.pp
| | -- node-eb31.pp | — modules
|— dr
| |— environment.conf
| |— manifests
| | |— site.pp
| | |— node-eb01.pp
| | -- node-bk01.pp | — modules
|— production
| -- manifests | |-- site.pp | |-- node-ag11.pp | |-- node-em01.pp — tst
|— environment.conf
|— manifests
| |— site.pp
| -- node-ag11.pp — modules
[/bash]
To reload configuration I am restarting puppet like this.
# svcadm disable puppet:master# svcadm enable puppet:masterAt the same time as enabling directory environments I simplified node manifests and captured here.
Node I could have used modules/classed but define is quicker and still fit my needs.
Add environments.onf file.
# pwd/etc/puppet/environments/dev
# cat environment.confmanifest = manifests/Using combination of site.pp and node specific manifests. I snipped both files for the relevant code.
# pwd
/etc/puppet/environments/dev/manifests
# cat site.pp
{ipaddress_net0}
Environment : msg = g = group ) {
#notify{ g: }
execPath = "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
exec { "projmod max-sem-ids":
command => "projmod -sK 'project.max-sem-ids=(privileged,100,deny)' group.g”,
require => Exec[“projadd group.g"\],
unless => "projects -l group.g | grep max-sem-ids | grep -c 100”,
path => $execPath,
}
}
if “-dsdb-” in hostname {
#notify {"{hostname} identified as an Oracle DB server will apply project and network tuning steps”:}
$execPath = “/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:”
exec { “ipadm smallest_anon_port tcp”:
command => “ipadm set-prop -p smallest_anon_port=9000 tcp”,
path => $execPath,
onlyif => “ipadm show-prop -o CURRENT -c -p smallest_anon_port tcp | grep -v 9000”
}
}
node default {
}
# more node-eb31.pp
node ‘node-eb31.domain.com’ {
host { ‘node-eb31.domain.com’:
ip => ‘10.2.14.95’,
host_aliases => [‘node-eb31’,‘loghost’],
}
user = “ebsdev3_o”
storage = “10.2.14.35”
A_environment = “EBSDEV3”
execPath = "/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
exec { "projadd group.group”:
command => “projadd -U group -p group”,
require => User[“user"\],
unless => "projects -l | grep -c group.group”,
path => $execPath,
}
exec { “usermod group user”],Exec[“projadd group.group"\],\],
unless => "projects -l group.group | grep users | grep -c execPath,
}
#### DB and Project Setting Checks
exec { “projmod max-shm-memory”:
command => “projmod -sK ‘project.max-shm-memory=(privileged,10737418240,deny)’ group.user”],Exec[“projadd group.group"\],\],
unless => "projects -l group.group | grep project.max-shm-memory | grep -c 10737418240”,
path => $execPath,
}
check_project { $group: }
A_environment”
file {
[ “/u01” ]:
ensure => directory,
#group => ‘401’,
mode => 0755;
[ “/software”,“/scratch” ]:
ensure => directory,
group => ‘401’,
mode => 0775;
[ “/var/opt/oracle”,“/u01/oradata”,“/u01/app”,“/u01/diag”,“/u01/diag/{b1}/data”,“{b1}/redo”,“{b1}/temp”,“{b1}/a
rchdest3”,“{b1}/fra", \]:
ensure => directory,
owner => "{user}“,
group => “{group}",
mode => "775";
\[ "/apps", "/apptmp" \]:
ensure => directory,
#group => "{group}“,
mode => 0755;
}
#### NFS Mounts Start
nfs_defaults2 = {
ensure => “present”,
fstype => “nfs”,
pass => ”-“,
options => “rw,bg,vers=3,proto=tcp,sec=sys,hard,nointr,llock,rsize=1048576,wsize=1048576,retrans=5,timeo=600”,
atboot => yes,
blockdevice => ’-‘
}
nfs_defaults4 = {
ensure => “present”,
fstype => “nfs”,
pass => ”-“,
options => “rw,bg,hard,rsize=1048576,wsize=1048576,vers=3,nointr,proto=tcp,suid”,
atboot => yes,
blockdevice => ’-’
}
nfs\_mounts1 = {
'/u01/app' => {
device => "storage:/export/USLI-MIDTIER/{ARB\_environment}/DBHOME",
},
}
nfs_mounts2 = {
‘/apps’ => {
device => “ARB_environment/APPS_CLONED”,
},
‘/apptmp’ => {
device => “ARB_environment/APPTMP”,
},
“/u01/diag/{ARB\_environment}" => {
device => "storage:/export/USLI-MIDTIER/{ARB\_environment}/DIAG",
},
}
nfs_mounts3 = {
“/u01/oradata/ARB\_environment/data" => {
device => "storage:/export/USLI-MIDTIER/ARB\_environment/DBDBF\_CLONED",
},
"/u01/oradata/ARB_environment/data1” => {
device => “10.2.14.35:/export/USLI-HIGHTIER/ARB\_environment/DBDBF1\_CLONED",
},
"/u01/oradata/ARB_environment/redo” => {
device => “storage:/export/USLI-HIGHTIER/EBSDEV3/DBREDO",
},
"/u01/oradata/ARB_environment/undo” => {
device => “ARB_environment/DBUNDO_CLONED”,
},
“/u01/oradata/ARB\_environment/temp" => {
device => "storage:/export/USLI-HIGHTIER/DBTEMP/EBSDEV3”,
},
“/u01/oradata/ARB\_environment/archdest1" => {
device => "{storage}:/export/USLI-MIDTIER/DBARCH/{ARB\_environment}\_DEST\_1",
},
"/u01/oradata/ARB_environment/archdest3” => {
device => “{storage}:/export/USLI-HIGHTIER/DBARCH/EBSDEV3\_DEST\_3",
},
"/u01/oradata/ARB_environment/fra” => {
device => “ARB_environment/DBFRA”,
},
}
nfs\_mounts4 = {
'/software' => {
device => "storage_archive:/export/NONPRD/STAGING/software”,
},
‘/scratch’ => {
device => “$storage:/export/USLI-MIDTIER/UTILITY/SCRATCH”,
},
}
create_resources(mount, nfs_defaults1)
create_resources(mount, nfs_defaults2)
create_resources(mount, nfs_defaults3)
create_resources(mount, nfs_defaults4)
#### NFS Mounts End
}
# pwd
/etc/puppet/environments
root@usli-utility:/etc/puppet/environments# hg commit
root@usli-utility:/etc/puppet/environments# cd ..
root@usli-utility:/etc/puppet# rsync -a —no-owner —no-group * /net/usli-psst-zf01.mgmt.asg.ad/export/NONPRD/UTILITY/CHANGELOGS/puppet/usli/
### Client
# svccfg -s svc:/application/puppet:agent setprop config/environment=DEV
# svcadm refresh puppet:agent
# svcadm restart puppet:agent
cat /etc/puppet/puppet.conf
# WARNING: THIS FILE GENERATED FROM SMF DATA.
# DO NOT EDIT THIS FILE. EDITS WILL BE LOST.
#
# See puppet.conf(5) and http://docs.puppetlabs.com/guides/configuring.html
# for details.
[agent]
environment = dev
logdest = /var/log/puppet/puppet-agent.log
server = usli-utility.mgmt.asg.ad
# puppet agent —test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for usli-dsdb-eb31.dev.asg.ad
Info: Applying configuration version ‘1501606469’
Notice: Finished catalog run in 3.43 seconds