Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all 6104 articles
Browse latest View live

difference between a !~ b and !(a=~b)

$
0
0
Hi all, I wrote a conditional like this: `if !( A =~ B )`. It is not working, because I should have written `if A !~ B`. Fine. However, I wasn't getting any syntax error or anything, so it must have been doing something. As far as I understand, the first form should also work, shouldn't it? What is the difference? Why wasn't it working? Thank you

puppetlabs-apt proxy settings for apt::key

$
0
0
I have some trouble with an apt::key deployment from this module : https://github.com/wazuh/ossec-puppet The code is apt::key { 'puppetlabs': id => '9FE55537D1713CA519DFB85114B9C8DB9A1B1C65', source => 'https://ossec.wazuh.com/repos/apt/conf/ossec-key.gpg.key', server => 'keyserver.ubuntu.com', options => 'http-proxy="http://proxy.domain.local:8080"' } Seems that source parameter URL is not using the proxy setting. If I configure my system with https_server variable it works. I think source code, use wget to grabe the file. Without this I got timeout error. From my point of view the bear minimum would be to update the documentation to reflect this behaviour.

Reorganize nested hash

$
0
0
I have a puppetdb query: "resources[certname,parameters]{type = 'my_special_type'}". The result looks like this: [ { "certname": "server1", "parameters: { "port": 1234, "job": "job1" } ] Imagine a few dozen servers with five different jobs. Is there a way to transform that into an object that looks like: [ { "job": "job1", "entries": ["server1:1234"] } ] Either by changing the query, or by using various Puppet functions to create a new hash? Is this possible directly in Puppet, or should I give up and write a function in Ruby which can be called from Puppet (note: I'm not even sure that it's possible to pass a structure back to Puppet)? If you need to know why I'm doing this: I'm trying to get nodes to self identify for various Prometheus scans. I've got that part working, so I can collect the necessary information form PuppetDB. Now I need to sort through it and create a config file.

How to reorganise a hash

$
0
0
I have a puppetdb query: "resources[certname,parameters]{type = 'my_special_type'}". The result looks like this: [ { "certname": "server1", "parameters: { "port": 1234, "job": "job1" } ] Imagine a few dozen servers with five different jobs. Is there a way to transform that into an object that looks like: [ { "job": "job1", "entries": ["server1:1234"] } ] Either by changing the query, or by using various Puppet functions to create a new hash? Is this possible directly in Puppet, or should I give up and write a function in Ruby which can be called from Puppet (note: I'm not even sure that it's possible to pass a structure back to Puppet)? If you need to know why I'm doing this: I'm trying to get nodes to self identify for various Prometheus scans. I've got that part working, so I can collect the necessary information form PuppetDB. Now I need to sort through it and create a config file.

how to add external fact as hash in puppet 4

$
0
0
I want to provide below hash as an external fact fact_dbmode_array={cdq0232a1 => primary} when i validate it, it is failing with Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Method call, block parameter 'this_sid' expects a String value, got Integer at /platform/components/dco/db_oracle_psu_patch/0_0_4_shaji/modules/db_oracle_psu_patch/manifests/test.pp:12:17 on node orf-ora12c-15.int.thomsonreuters.com test code: $dbmode_hash.each | String $this_sid, String $dbmode | { notify {"DBMODE for ${this_sid} is ${dbmode}":} } ideal result :- Notice: DBMODE for cdq0232a1 is primary Any help is really appreciated

How to loop trough nested hash in epp?

$
0
0
Hi, At the company I'm working at we have a script to automate the creation of symbolic links. This script is fed it's input from a puppet module. The current version of the module uses files, but it is a wish to separate the code from the config, so the module can be shared, but the config can be kept. I've already setup a data structure that can be used and I build an erb template to provide the the main configuration. However, the current module has an option to 'add' files in a directory with user specified name, but same layout, so I'm now trying to rewrite the erb to an epp to provide the same output as the erb, but with the flexibility to add additional configurations. The datastructure: mod::var: 'section1': 'part.1': source: 'source1' target: 'target1' 'part.2': source: 'source2' target: 'target2' 'section2': 'part.3': source: 'source3' target: 'target3' The erb: <% @var.each do |section, entries| %> [<%= section %>]<% entries.each do |entry, config| %><% config['source'] %> = <% config['target'] %><% end -%><% end %> The output [section1] source1 = target1 source2 = target2 [section2] source3 = target3 The 'part.1' key is needed as 'source' is not unique, 1 keyword is used to indicate that all files need to be linked to target dir. It was added to have a unique hash key, but is ignored in the output. I've rewritten the erb to the epp below <% | Hash[String, Hash[String, Hash[String, String]]] $var | -%><% include stdlib %><% $var.keys.sort.each do |$section, $entries| { %> [<%= $section %>]<% $entries.keys.sort,each do |$entry, $config| { %><% $config['source'] %> = <% $config['target'] %><% } -%><% } %> This should be correct, at least when I check with the very limited examples online, but it doesn't behave as I expect it to. This epp template results in an error that the 2nd keys operation expects a hash. When I remove the 2nd loop, just to see which sections i get, the output is as below. [1] [2] [3] Which looks more like an array index then the content of the keys. When I remove the sort.each, as I don't care about the sort order and each looks like you loop trough an array, the resulting output is empty. Thinking I'm using keys function wrong I even tried the code below: <% | Hash[String, Hash[String, Hash[String, String]]] $var | -%><% include stdlib %><% $var.keys.each do |$section| { %> [<%= $section %>]<% $var[$section].keys.each do |$entry| { %><% $var[$section][$entry]['source'] %> = <% $var[$section][$entry]['target'] %><% } -%><% } %> But still the output is empty. A lookup of mod::var gives the expected output on the puppet server. (btw output is empty means in all cases 'mod::var is not used', comment lines printed by the template are given, including if it's using an epp or erb template) init.pp section for this template: file { 'name': ensure => present, content => epp('template.epp', { var => $var, } } Puppet version 4.10.9 on RHEL 6 and 7. I would like to get the epp working and resulting in the same output as the erb. As the alternative would be a tricky rewrite of the configuration, which became so complex in the years it's in use I'd rather tackle the template (learn something new) then dive in the script while it's maintainer is on holiday. Thanks in advance for any help I can get. Jan Huijsmans

"Error: Could not render to rich_data_json" when pushing binary file to host

$
0
0
I just installed a new host which is installed with puppet 6.0.0 Next to that I use a puppet server with foreman, which started with Foreman 1.12/puppet 4 and is now upgraded to Foreman 1.19/puppet 5.5.6 I have one module, which installs a C-compiled file on a server, using the following code : file { 'super-handy-tool': path => "/some/dir/on/system/handy-tool", ensure => file, content => file("my_module/handy-tool"), owner => 'root', group => 'root', mode => '4755', } When I run the "puppet agent -t" on the host, I get the following output : Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Retrieving locales Info: Loading facts Info: Caching catalog for my.host.local Info: Unable to serialize catalog to json, retrying with pson Error: Could not render to rich_data_json: source sequence is illegal/malformed utf-8 Info: Applying configuration version '1538142357' I did try to change the "ensure => file" to "ensure => present", but this did not solve the error. Does anyone have an idea get rid of this error ?

How can I have the puppetlabs/tomcat module manage systemd services?

$
0
0
How can I get puppetlabs/tomcat to manage a systemd service for each of the tomcat instances it is managing? The module handles starting the services itself on a catalog run, but I haven't yet found how to get it to manage systemd services to automatically start on server reboot.

Cisco SG350XG Puppet Integration

$
0
0
Hi, From reading the documentation under (https://puppet.com/products/managed-technology/cisco), it appears there are two options for configuring Cisco switches with puppet. IOS and Open NX-OS. Just wondering if anyone happens to know which of these options, if any, would be supported on Cisco SG350XG model switches? We just made the move from HP/Aruba to Cisco so we don't have a lot of experience with Cisco switches and I'd prefer to do it through puppet if possible. Thanks

What You Ought To Understand About Internet Marketing.

Best methods to debug Error 500 on SERVER, Could not find class

$
0
0
I'm relatively new to Puppet and am in the process of trying to deploy configuration. When I try to deploy (on master or client node) I get the error listed above. I would really appreciate best methods and/or guidance on how to go about debugging/resolving this issue. Thanks in advance!

Keep "data" and "modules" directory on offline agents in sync with puppet master

$
0
0
Hi, I am new to the puppet. I have an online server master and 100 offline servers with agents, how can I sync data and install all required modules. I thought Puppet will take care of it automatically, but looks like I have to do something. Regards

How to sync "data" and "manifest" folders between all agents

$
0
0
Hi, I am new to the puppet. I have an online server master and 100 offline servers with agents, how can I sync data and install all required modules. I thought Puppet will take care of it automatically, but looks like I have to do something. Regards

question on puppet types and hiera yaml

$
0
0
Downloaded the m4ce keepalived module from puppetlabs . In the real_server.pp file it has the following definition : type Keepalived::Virtual_server::Real_server = Struct[{ Optional[virtual_server] => String, Optional[weight] => Integer[1], Optional[lvs_method] => Keepalived::Virtual_server::Lvs_methods, Optional[inhibit_on_failure] => Boolean, Optional[notify_up] => String, Optional[notify_down] => String, Optional["HTTP_GET"] => Keepalived::Virtual_server::Real_server::Http_check, Optional["SSL_GET"] => Keepalived::Virtual_server::Real_server::Http_check, Optional["TCP_CHECK"] => Keepalived::Virtual_server::Real_server::Tcp_check, Optional["SMTP_CHECK"] => Keepalived::Virtual_server::Real_server::Smtp_check, Optional["DNS_CHECK"] => Keepalived::Virtual_server::Real_server::Dns_check, Optional["MISC_CHECK"] => Keepalived::Virtual_server::Real_server::Misc_check }] In my yaml file I can define info for each of these but I don't understand the quoted Optional args, spec how to declare them in a yaml file (if thats even possible); 'virt1': virtual_server: 'myVirt' lvm_method: DR ??? "TCP_CHECK": ???? It doesn't make sense how to write yaml for the params that are quoted. Cheers for any suggestions

puppet cert deprecated?

$
0
0
I am testing an install of PE 2018.1.4 (puppet 5.5.6) When trying to regenerate an agent cert, I am getting: root@puppetmaster # puppet cert clean host.domain.com Warning: Accessing 'cakey' as a setting is deprecated. (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/settings.rb:1165:in `issue_deprecation_warning') Warning: `puppet cert` is deprecated and will be removed in a future release. (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:370:in `run') Notice: Revoked certificate with serial 47 Notice: Removing file Puppet::SSL::Certificate host.domain.com at '/etc/puppetlabs/puppet/ssl/ca/signed/host.domain.com.pem' Notice: Removing file Puppet::SSL::Certificate host.domain.com at '/etc/puppetlabs/puppet/ssl/certs/host.domain.com.pem' root@puppetmaster # What is the procedure to clean certs these days? The PE 2018 documentation says to use "puppet cert clean". Thanks Bill

puppet agent -t with different role or facter value

$
0
0
Is there a way to run puppet agent -t with a different role that is assigned to a server during a noop? Can you pass a one time run as well?

Simple Steps On just How To Fight Sleep Apnea Easily

puppet cert deprecated?

$
0
0
I am testing an install of PE 2018.1.4 (puppet 5.5.6) When trying to regenerate an agent cert, I am getting: root@puppetmaster # puppet cert clean host.domain.com Warning: Accessing 'cakey' as a setting is deprecated. (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/settings.rb:1165:in `issue_deprecation_warning') Warning: `puppet cert` is deprecated and will be removed in a future release. (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:370:in `run') Notice: Revoked certificate with serial 47 Notice: Removing file Puppet::SSL::Certificate host.domain.com at '/etc/puppetlabs/puppet/ssl/ca/signed/host.domain.com.pem' Notice: Removing file Puppet::SSL::Certificate host.domain.com at '/etc/puppetlabs/puppet/ssl/certs/host.domain.com.pem' root@puppetmaster # What is the procedure to clean certs these days? The PE 2018 documentation says to use "puppet cert clean". Thanks Bill

Is puppet-lint busted with respect to autoload module layout ?

$
0
0
It complains about this: # Class: sandbox # class sandbox{ # A Testing Sandbox for PUppet Code include 'stdlib' notify{'Hello from the Sandbox':} } puppet-lint 2.3.3 Came with pdk

stankevich/python Module to upgrade pip

$
0
0
The default version of pip is 1.1.I want to upgrade the version of pip to 8.1.1.I don't see any option to do that in the module.I tried to ` include python python::pip { 'pip': path => ['/usr/bin'], ensure => '8.1.1', install_args => 'index-url=https://pypi.python.org/simple/', } ` But I get the following error : > Pip command not found if I try to install any package python::pip { 'kafka-python': }
Viewing all 6104 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>