I have a requirement wherein i need to spin up a docker image from my Centos 7 VM to build a puppet master with hiera data and to run puppet agent which has a catalog with role and profile modules. I need to do this with beaker-rspec. Any ideas or links to documentation as to how to create puppet master from beaker-rspec? Please provide examples. TIA.
P.S: I found a way to scp to host the hiera data and hiera.yaml but that didn't fetch the hiera data in the modules. Hiera data for all the fields were blank.
↧
How to setup a puppet master in beaker-rspec
↧
Where is the proper place to put templates using roles and profiles practices?
I'm trying to create a template for use by the motd class in my base profile. I'm not quite sure where I should put it though. I'm also having trouble referencing the path from with the class.
Here is my control data structure:
/site/profile/manifests
--> base.pp
--> templates/
----> motd.erb
base.pp:
class profile::base {
class { 'motd':
template => 'templates/motd.erb'
}
}
But I get the following when trying to deploy it:
> Could not find template> 'templates/motd.erb' at> /etc/puppetlabs/code/environments/wsaxton/modules/motd/manifests/init.pp:22:21> on node drmbksca.local
↧
↧
How to use role custom fact in Puppet
I'm using a control-repo for my puppet master profiles/roles.
I'm using Hiera and I would like to add role as hierarchy
my hiera.yaml looks like :
:backends:
- yaml
:yaml:
:datadir: "/etc/puppetlabs/code/environments/%{::environment}/hieradata"
:hierarchy:
- "nodes/%{::trusted.certname}"
- "roles/%{::role}"
- "common"
the puppet agent doesn't seem to have the role fact. so I added a role fact in /etc/puppetlabs/facter/facts.d
But I don't want to do this for every node. I want this to be automatic.
do you have any ideas guys ?
↧
How to use role custom fact in Puppet
I'm using a control-repo for my puppet master profiles/roles.
I'm using Hiera and I would like to add role as hierarchy
my hiera.yaml looks like :
:backends:
- yaml
:yaml:
:datadir: "/etc/puppetlabs/code/environments/%{::environment}/hieradata"
:hierarchy:
- "nodes/%{::trusted.certname}"
- "roles/%{::role}"
- "common"
the puppet agent doesn't seem to have the role fact. so I added a role fact in /etc/puppetlabs/facter/facts.d
But I don't want to do this for every node. I want this to be automatic.
do you have any ideas guys ?
↧
Error: Could not request certificate: Failed to open TCP connection to puppet:8140 (getaddrinfo: Name or service not known)
Hello everyone,
Hello,
Here I am trying to learn to use Puppet to a future job and so I decide to mount a Lab in Vbox .
So I have two bridge machine
- Ubuntu puppet agent 192.168.0.5
- Debian puppet master server 192.168.0.14
So I ping the two machines with Ip and hostsmane .
telnet from my client on the server works but when I want to apply for a cert to my server I have the following message appears
Error: Could not request certificate: Failed to open TCP connection to puppet:8140 (getaddrinfo: Name or service not known)
Here my puppet.conf on puppet agent machine
>
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/run/puppet
factpath=$vardir/lib/facter
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post
report=true
rundir=/var/run/puppet/
certname=debianserverpuppet
server=debianserverpuppet
environment=test
runinterval=50
[agent]
listen = true
[master]
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY
My iptables :
rbo@rbo-VirtualBoxOpenClassRoom:/etc/puppet$ sudo iptables -L --line-number
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- debianserverpuppet 192.168.0.5 state NEW,ESTABLISHED tcp dpt:8140
2 ACCEPT tcp -- anywhere anywhere tcp dpt:8140 state NEW
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 192.168.0.5 debianserverpuppet state NEW,ESTABLISHED tcp spt:8140
↧
↧
Puppet Powershell execution
I have an application which requires a local account to be required for the configuration.
I have created a module inside that I have 2 folders :
i. files
ii.manifests
under manifests init file I have the below code:
class xyz {
exec { ' app_config':
command => ' C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -file c:\provisioning\modules\xyz\files\config1.ps1 '
}
}
Under files folder there are 2 files
i. config1.ps1
ii. app_execute.bat
Under config1.ps1 I am creating a local user :
$user = $env:COMPUTERNAME/Testing
$Credentials = New-Object -TypeName System.management.Automation.PScredential -ArgumentList $user, ("test@3456", | Convertto-securestring -ASplaintext -force)
Start-Process C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe -Credential $Credentials -ArgumentList " Start-Process
C:\Windows\System32\cmd.exe -file c:\provisioning\c:\provisioning\modules\xyz\files\app_execute.bat "
Under app_execute.bat
c:\puppet\app.bat -f c:\puppet\responsefile.rsp
The log file shows that the powershell file config1.ps1 got executed successfully, but the application log file is not getting generated, but when executed manually the config1.ps1 the app will get configured.
Not sure, in config1.ps1, I am using a start-process which will create a separate process using the local account.
I think the puppet is not waiting for the above config1.ps1 to be completed succesfully.
Not sure why it is coming out without executing fully, Is there any condition, as we need to execute only one file inside init, as I am initiating 2 processes.
Please advise.
↧
How to call Teamcity API through Puppet Module
Hi All,
I have Puppet Master and Windows agent server. I have installed Teamcity CI application, I have to make the Teamcity below REST api automation through Puppet . Below are the API that I want to in Puppet Module, How we can do ?
1. curl -u admin:password \
-X POST \
-d 'test-project1' \
-H 'Content-Type: text/plain' \
http://teamcity:8111/httpAuth/app/rest/projects/
2. curl -u admin:password \
-H "Content-Type: application/xml" \
-d @vcs-root.xml \
-X POST \
http://teamcity:8111/httpAuth/app/rest/vcs-roots/
I have question, How to make it automatically through Puppet ?
↧
How do you make multiple *ix installs available in puppet enterprise's puppetlabs/server/data/packages/public/ script install environment?
This environment does not have internet access and I'd like to be able to install all *ix agents with a curl command method. The documentation at https://docs.puppet.com/pe/latest/install_agents.html is unclear.
↧
Problems with each loop and future parser
Hey there,
I am writing a small init puppet config to configure my servers without puppet master.
For creating user accounts I want iterate via an each loop over a array of user names
defined in a hiera file.
Without running the future parser my example each loop is not working and if i use it
my data in the yaml file cant be read.
I installed the the puppet-common pkt (vers: 3.8.7-1puppetlabs1) on Ubuntu 12.04. Should each not run
in this version without future parser?
The class iterating over the users:
#modules/manage_users/manifests/init.pp
class manage_users($users,){
group { 'test':
ensure => 'present'
}
['a','b','c'].each |Integer $index, String $value| { notice("${index} = ${value}") }
#each($users) |$user| {
#notify{"user: ${user}",}
# group {"${user}":
# ensure => 'present'
# }
# user { "${user}" :
# ensure => 'present',
# groups => [$user, test],
# home => "/home/${user}",
# shell => '/bin/bash',
# }
}
My hiera.yaml:
:backends:
- yaml
:yaml:
:datadir: /etc/puppet/hieradata
:hierarchy:
- lpkb
The yaml with the data:
#hieradata/lpkb.yaml
manage-users::users:
- user1
- user2
manage-users::test: test
puppet.conf:
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
If I run without future parser:
puppet apply manifests/site.pp
Error:
Error: Syntax error at '['; expected ']' at /etc/puppet/modules/manage_users/manifests/init.pp:7 on node vps1234.localhost.local
Error: Syntax error at '['; expected ']' at /etc/puppet/modules/manage_users/manifests/init.pp:7 on node vps1234.localhost.local
With future parser:
puppet apply --parser=future manifests/site.pp
Error: Evaluation Error: Error while evaluating a Function Call, Must pass users to Class[Manage_users] at /etc/puppet/manifests/site.pp:3:5 on node vps1234.localhost.local
Error: Evaluation Error: Error while evaluating a Function Call, Must pass users to Class[Manage_users] at /etc/puppet/manifests/site.pp:3:5 on node vps1234.localhost.local
What am I doing wrong?
↧
↧
How do I express an empty array in Hiera?
I need to override the default value of class parameter for a module which expects an array. I can do this easily enough with traditional Puppet code:
class { 'foo':
bar => []
}
However, I would like to have all the parameters in Hiera using the automatic class parameter lookup. Can this even be done? BTW, I'm using YAML format.
↧
failed: DataBinding 'hiera': undefined method `empty?' for nil:NilClass
Hello,
we just restored puppetserver from backup but after restoration puppet server is not entirely happy.
It gives this error:
/opt/puppetlabs/bin/puppet agent --test
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Lookup of key 'profile::ruby::packages' failed: DataBinding 'hiera': undefined method `empty?' for nil:NilClass at /etc/puppetlabs/code/modules/profile/manifests/base.pp:2:5 on node ldl.EXAMPLE.COM
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
i am running puppetserver version: **2.5.0**
# puppetserver gem list
*** LOCAL GEMS ***
deep_merge (1.0.1)
hiera-eyaml (2.0.8)
hiera-eyaml-gpg (0.5)
highline (1.6.21)
jar-dependencies (0.1.13)
jruby-openssl (0.9.7 java)
json (1.8.0 java)
mini_portile (0.6.2)
rake (10.1.0)
rdoc (4.1.2)
ruby_gpg (0.3.2)
trollop (2.1.2)
# /opt/puppetlabs/puppet/bin/gem list
*** LOCAL GEMS ***
bigdecimal (1.2.4)
deep_merge (1.0.1)
facter (3.4.1)
hiera (3.2.1)
hiera-eyaml (2.1.0)
hiera-eyaml-gpg (0.6)
highline (1.6.21)
hocon (0.9.3)
io-console (0.4.3)
json (1.8.1)
minitest (4.7.5)
net-ssh (2.9.2)
psych (2.0.5)
puppet (4.6.1)
rake (10.1.0)
rdoc (4.1.0)
semantic_puppet (0.1.2)
stomp (1.3.3)
test-unit (2.1.9.0)
trollop (2.1.2)
# cat /etc/puppetlabs/code/hiera.yaml
---
:backends:
- yaml
- eyaml
:hierarchy:
- "%{::environment}/%{::trusted.certname}"
- "%{::environment}"
- common
:yaml:
:datadir: /etc/puppetlabs/code/hieradata
:eyaml:
:datadir: /etc/puppetlabs/code/hieradata
:merge_behavior: deeper
when i run hiera manually looks like it is working:
# hiera 'profile::ruby::packages' environment=production
["ruby"]
here are manifests that are part of above error
# cat /etc/puppetlabs/code/modules/profile/manifests/base.pp
class profile::base {
include profile::ruby
$useful_packages = hiera("profile::useful::packages")
package {$useful_packages:
ensure => latest,
}
}
# cat /etc/puppetlabs/code/modules/profile/manifests/ruby.pp
class profile::ruby (
$packages = hiera('$profile::ruby::packages'),
$version = hiera('$profile::ruby::version'),
) {
package { $packages:
ensure => $version
}
}
Can anyone point what should be done to fix puppet.?
thanks
Wkg
puppet server error:
2016-09-20 10:11:13,245 DEBUG [qtp1550957461-29] [puppetserver] Puppet Performing a hiera indirector lookup of lookup_options with options {:variables=>Scope(Class[Profile::Ruby]), :merge=>#>, @value_type=#]>>>]>, @options={}>}
2016-09-20 10:11:13,245 DEBUG [qtp1550957461-29] [puppetserver] Puppet Performing a hiera indirector lookup of lookup_options with options {:variables=>Scope(Class[Profile::Ruby]), :merge=>#>, @value_type=#]>>>]>, @options={}>}
2016-09-20 10:11:13,647 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Hiera YAML backend starting
2016-09-20 10:11:13,647 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Hiera YAML backend starting
2016-09-20 10:11:13,648 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Looking up lookup_options in YAML backend
2016-09-20 10:11:13,648 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Looking up lookup_options in YAML backend
2016-09-20 10:11:13,652 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Looking for data source production/ldl.EXAMPLE.COM
2016-09-20 10:11:13,652 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Looking for data source production/ldl.EXAMPLE.COM
2016-09-20 10:11:13,665 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Looking for data source production
2016-09-20 10:11:13,665 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Looking for data source production
2016-09-20 10:11:13,685 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Looking for data source common
2016-09-20 10:11:13,685 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Looking for data source common
2016-09-20 10:11:13,698 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Hiera eYAML backend starting
2016-09-20 10:11:13,698 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Hiera eYAML backend starting
2016-09-20 10:11:13,699 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Using Hiera 1.x backend API to access instance of class Hiera::Backend::Eyaml_backend. Lookup recursion will not be detected
2016-09-20 10:11:13,699 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Using Hiera 1.x backend API to access instance of class Hiera::Backend::Eyaml_backend. Lookup recursion will not be detected
2016-09-20 10:11:13,699 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Set option: datadir = /etc/puppetlabs/code/hieradata
2016-09-20 10:11:13,699 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Set option: datadir = /etc/puppetlabs/code/hieradata
2016-09-20 10:11:13,700 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Looking up lookup_options in eYAML backend
2016-09-20 10:11:13,700 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Looking up lookup_options in eYAML backend
2016-09-20 10:11:13,701 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Looking for data source production/ldl.EXAMPLE.COM
2016-09-20 10:11:13,701 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Looking for data source production/ldl.EXAMPLE.COM
2016-09-20 10:11:13,701 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Cannot find datafile /etc/puppetlabs/code/hieradata/production/ldl.EXAMPLE.COM.eyaml, skipping
2016-09-20 10:11:13,701 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): Cannot find datafile /etc/puppetlabs/code/hieradata/production/ldl.EXAMPLE.COM.eyaml, skipping
2016-09-20 10:11:13,702 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Looking for data source production
2016-09-20 10:11:13,702 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Looking for data source production
2016-09-20 10:11:13,707 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Looking for data source common
2016-09-20 10:11:13,707 DEBUG [qtp1550957461-29] [puppetserver] Puppet hiera(): [eyaml_backend]: Looking for data source common
2016-09-20 10:11:13,726 ERROR [qtp1550957461-29] [puppetserver] Puppet Evaluation Error: Error while evaluating a Function Call, Lookup of key 'profile::ruby::packages' failed: DataBinding 'hiera': (): expected , but found BlockMappingStart while parsing a block mapping at line 1069 column 6 at /etc/puppetlabs/code/modules/profile/manifests/base.pp:2:5 on node ldl.EXAMPLE.COM
↧
test Puppet enterprise upgrade
Hi friends,
I want to upgrade my puppet enterprise 3.7.2 to 3.8.6 version. I want to make sure that all modules should able to run properly after upgrade.
Is there any tool or specific method to test puppet enterprise upgrade ?
↧
Set File content via Hiera
Hi,
I am looking for the syntax to set the content for a File resource from hiera. Specifically I want to set the template being used:
# Puppet
class test (
$file_content = undef,
){
file{'/tmp/testfile':
ensure => file,
content => $file_content,
}
}
# Hiera
---
test::file_content: template('modules/test/test.erb')
Since Hiera is returning a string, the template function is not being evaluated.
I am pretty sure I saw this being done somewhere, but I cannot figure out the correct syntax anymore.
↧
↧
Is there a way to declare declare a custom type by it's fully qualified name?
I'm currently using 2 puppet modules, and they both have custom types, which happen to have the same names:
https://github.com/fiddyspence/puppet-zabbix/tree/master/lib/puppet/type
and:
https://github.com/voxpupuli/puppet-zabbix/tree/master/lib/puppet/type
In this example, we have 2 modules that each have a custom type called "zabbix_host" and "zabbix_hostgroup"
I tried to declare them, but in my case they are being evaluated by the wrong .rb fie. Is there a syntax I can use to refer to a custom type by it's fully qualified name?
↧
Removing a Package if files are absent
Hello,
I have a package that I have in as an rpm. It installs the package initially and then checks to make sure it is installed. However if someone deletes important files within in this package then this is useless because the package is still installed but important files are no longer there. Therefore I would like to check if certain files are missing then to uninstall the package and reinstall it. Is there a way to do this?
thanks,
↧
How to Install same package with both pip and pip3 provider
Hi everyone,
I have both Python 2x & 3x scripts running on my server. I have several packages where I need to install both the versions of a package. How can I install the same package name with both pip and pip3? I'm getting errors where the package name is already defined (even though they're in separate classes). I've tried aliasing and that hasn't worked either.
Thanks for any help....
↧
How to map an array within a resource
I've got stuck trying to use Puppet 3.8 to tackle what seems like it should be a simple problem.
My nodes have a number of independent installations of a single system.
I have defined a top-level type which creates instances of many resources. My nodes then declare a number of instances, and all the resources are instantiated, just as I'd like.
Now, I'd like to augment each installation with its own set of externally node-specified directories.
So when my node declares...
installation { "user1": subdirs => ["subdir1", "subdir2"] }I'd like to end up creating (say)
/home/user1/subdir1 /home/user1/subdir2How do I do that? In particular, how (within the class) do I transform the list of subdirectory names
["subdir1", "subdir2"]into names that are unique to the instance of the class, such as
["installation1/$subdir1", "installation1/$subdir2" ]
↧
↧
What is the Export Control Classification Number (ECCN) for Puppet
Hi,
I need to know the ECCN for Puppet for TCC certification of our product. Can you let us know what that is?
Our understanding is that Puppet has encryption capabilities. Can you please also confirm that.
Best regards
Moeen
↧
Error when a node tries to connect to puppetserver
Hello guys,
I'm trying to connect a node to my puppet server, all certificates are good but when it tries to retrieve his catalog, i got this error in the puppetserver foreground console :
" [c.p.p.ShellUtils] Executed an external process which logged to STDERR: No such file or directory @ rb_file_s_stat - /opt/puppetlabs/puppet/cache/yaml/facts/my_node.yaml "
Is anyone have an idea ?
Thanks.
↧
how to resolveConnection time out Error when running nodejs app using puppet
I am cloning my repo and running my nodejs application using puppet. please find the code below:
package { 'git':
ensure => 'latest',
}
vcsrepo { "/nodejs-helloworld":
ensure => latest,
provider => git,
require => [ Package["git"] ],
source => "git@gitlab.abc.dev.net:hello-world/nodejs-helloworld.git",
revision => 'master',
before => Exec['/usr/local/bin/npm install;/usr/local/bin/npm start'],
}
exec { '/usr/local/bin/npm install;/usr/local/bin/npm start':
cwd => '/nodejs-helloworld',
subscribe => Vcsrepo['/nodejs-helloworld'],
refreshonly => true,
}
My repository is cloned,and also my application is running fine and npm test also works.Everything works fine. but i get connection time out error.
Error Log:
[root@ip-*******/]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for ip-**************
Info: Applying configuration version '1474433486'
Notice: /Stage[main]/Main/Exec[install-node-version-manager-global]/returns: executed successfully
Notice: /Stage[main]/Main/Exec[install-node-version-manager-latest]/returns: executed successfully
Notice: /Stage[main]/Main/Vcsrepo[/nodejs-helloworld]/ensure: Creating repository from latest
Notice: /Stage[main]/Main/Vcsrepo[/nodejs-helloworld]/ensure: created
Info: /Stage[main]/Main/Vcsrepo[/nodejs-helloworld]: Scheduling refresh of Exec[/usr/local/bin/npm install;/usr/local/bin/npm start]
Error: /Stage[main]/Main/Exec[/usr/local/bin/npm install;/usr/local/bin/npm start]: Failed to call refresh: Command exceeded timeout
Error: /Stage[main]/Main/Exec[/usr/local/bin/npm install;/usr/local/bin/npm start]: Command exceeded timeout
Notice: Finished catalog run in 302.86 seconds
As you can see here eventhough i get connection time out error, my app is running. and npm test works.
[root@ip-********* nodejs-helloworld]# netstat -anp 2> /dev/null | grep :3000
tcp6 0 0 :::3000 :::* LISTEN 17630/node
[root@ip-********* nodejs-helloworld]# npm test> nodejs-helloworld@1.0.0 test /nodejs-helloworld> mocha
Test HelloWorld
✓ Should have the root route (46ms)
✓ Should have a hello world response
2 passing (66ms)
Can anyone please tell me how to avoid the connection timeout error.
↧