Hi,
I'm new to puppet and read docs as much as possible, so forgive some
confusion in my code.
ubuntu-common.yaml:
---
packages:
- bc
- bsd-mailx
- fail2ban
- logrotate
- open-vm-tools
- openssh-server
- rsyslog
- rsync
- sudo
- snmpd
apacheModules:
- auth_kerb
- authnz_ld
jcbollinger wrote:
> On Saturday, June 4, 2016 at 7:20:19 PM UTC-5, Helmut Schneider wrote:
> >
> > Hi,
> >
> > I'm new to puppet and read docs as much as possible, so forgive
> > some confusion in my code.
[Code]
> Consider this call:
>
> h
jcbollinger wrote:
>
> On Tuesday, June 7, 2016 at 8:02:24 AM UTC-5, Helmut Schneider wrote:
> >
> > jcbollinger wrote:
> >
> >
> Without the case statement, how can I make sure that ubuntu only
> > receives classes for ubuntu and not e.g. for Wind
Hi,
I want to copy files if a package is installed. What works fine with
the packages 'postfix', 'fail2ban' and 'apache2' does not with
'openssh-server.
class fail2ban {
$postfixPackage = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => 'postfix',
default => 'undef'
Rob Nelson wrote:
> Your code only shows one package, $package, being created, but it
> does not show where the value for $package is set. Either that var
The package block is missleading, it just installs fail2ban:
$package = $::operatingsystem ? {
/(?i:Ubuntu|Debian|Mint)/ => 'fail2ban',
Hi,
apache/manifests/init.pp defines:
if $::apache::conf_dir and $::apache::params::conf_file {
case $::osfamily {
'debian': {
$error_log= 'error.log'
$scriptalias = '/usr/lib/cgi-bin'
$access_log_file = 'access.log'
}
I would l
Craig Dunn wrote:
> Given the above, what are you trying to achieve? Are you trying to
> manage the file resource after the package resource, or are you
> saying you only want to manage the file if the package exists on the
> target system?
The latter. If openssh-server is installed, copy the fi
Rob Nelson wrote:
> Modeling state can be tricky. It's pretty easy for a human to
> understand conditionals like "If a package is installed, install a
> file," but for state modeling, resources are best defined as either
> managed or unmanaged, not somewhere in between. It's important to
> keep th
Hi,
Given the following structure:
hiera.yaml:
[...]
:hierarchy:
- nodes/%{::fqdn}
[...]
- common
:merge_behavior: deeper
common.yaml:
[...]
profiles:
webserver:
apache:
modules:
- auth_kerb
- authnz_ldap
- cgid
- status
host.yaml:
profiles:
web
Peter Kristolaitis wrote:
> > How can I ensure that mpm_* is always the first element in the
> > array?
>
> Assuming you're trying to solve the problem I think you're trying to
> solve (i.e. to have Apache with the correct process model installed
> before any additional modules), it's important to
Hi,
common.yaml:
profiles:
mailserver:
postfix:
instances:
postfix-in:
instance_path: '/etc/postfix-in'
other_path:"%{instance_path}" <= required
Is it possible to nest both variables somehow? Or alternatively from
common.pp:
$instance_path =
$profil
Hello all,
let's assume the following structure in a yaml:
profiles:
vpn:
openvpn:
instances:
client:
myclient:
remote: 'openvpn_host 1194'
I would now like to check if e.g. "client" exists:
if ($profiles['vpn']['openvpn']['instances']['client
Ben Ford wrote:
> What you're looking for is the dig() function.
> https://puppet.com/docs/puppet/latest/function.html#dig
>
> $profiles.dig('vpn', 'openvpn', 'instances', 'client')
>
> On Wed, Jul 11, 2018 at 8:32 AM Helmut
Angel L. Mateo wrote:
> El 21/06/18 a las 14:32, Helmut Schneider escribió:
> > Hi,
> >
> > common.yaml:
> >
> > profiles:
> >mailserver:
> > postfix:
> >instances:
> > postfix-in:
> >
Hi,
openvpn.yaml:
[...]
profiles:
vpn:
openvpn:
defaults:
client:
dev: 'tun'
proto: 'udp'
resolv-retry: 'infinite'
nobind:
user: 'nobody'
group: 'nogroup'
Christopher Wood wrote:
> Have you considered switching to an EPP template? You can limit the
> data passed in to only valid types (otherwise catalog compilation
> failure), it's quite useful.
Not yet. And I'm not sure if that will help. In my case there are
commands with and without parameters:
Christopher Wood wrote:
> On Fri, Jul 13, 2018 at 03:44:04PM +0000, Helmut Schneider wrote:
> > Christopher Wood wrote:
> >
> > > Have you considered switching to an EPP template? You can limit
> > > the data passed in to only valid types (otherwise catalog
>
Christopher Wood wrote:
> Nice catch, wouldn't have figured on that.
You gave the hint with "if value.is_a? String" ;)
And now? Is that expected? What can I do, "if
@openvpnConf[parameter].is_a? Symbol"?! And what is a symbol and how do
I check if it empty?
Even more questionmark now...
--
Yo
Henrik Lindberg wrote:
> On 2018-07-13 19:39, Helmut Schneider wrote:
> > Christopher Wood wrote:
> >
> > > Nice catch, wouldn't have figured on that.
> >
> > You gave the hint with "if value.is_a? String" ;)
> >
> > And now?
Henrik Lindberg wrote:
> On 2018-07-14 13:47, Johan Fleury wrote:
> > I meant bool2str, sorry.
> >
> >
https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/README.md#bool2str
> >
>
> Helmut, before digging yourself deeper into problems by using work
> around on top of problems - do consi
Henrik Lindberg wrote:
> On 2018-07-15 15:45, Helmut Schneider wrote:
> > <%- | Hash $openvpnConf,
>
> It is important that there is no text before the opening <%-
> Not sure if you have a blank line there. If so you will get a syntax
> error because of the text outpu
Henrik Lindberg wrote:
> On 2018-07-16 10:21, Helmut Schneider wrote:
> > How can I fix this?
> >
>
> It is a bug, please file a ticket in puppet's Jira for project PUP.
https://tickets.puppetlabs.com/browse/PUP-9005
Thank you!
--
You received this message because
Hi,
---
profiles:
vpn:
openvpn:
defaults:
client:
dev: 'tun'
proto: 'udp'
resolv-retry: 'infinite'
nobind:
user: 'nobody'
group: 'nogroup'
persist-key:
R.I. Pienaar wrote:
>
> > On 19 Jul 2018, at 21:19, Henrik Lindberg
> > wrote:
> >
> >> On 2018-07-19 17:15, Helmut Schneider wrote:
> >> Hi,
> >> ---
> >> profiles:
> >> vpn:
> >> openvpn:
>
Hi,
is there a way to format text in epp? Something like
a 100
abc20
defgds 30
Thank you!
<%- | Hash $postfixTransport
| -%>
# This file is managed by Puppet, don't edit it by hand.
# All changes will be overwritten!
<% if ($postfixTransport) { -%>
<% $postfixTransport.each |$domain,
jcbollinger wrote:
> On Wednesday, August 1, 2018 at 5:05:32 AM UTC-5, Helmut Schneider
> wrote:
> >
> > Hi,
> >
> > is there a way to format text in epp? Something like
> >
> > a 100
> > abc20
> > defgds 30
>
Hi,
I want to include hiera classes.
---
roles::webserver::apache::classes:
- my_apache
roles::backup::bacula::classes:
- bacula
roles::timeserver::ntpd::classes:
- ntpd
roles::databaseserver::mysql::classes:
- mysqld
I used to use the follwoing (ugly) code in nodes.pp to do so:
if ($
Hi,
I want to check if a variable is numeric. The manpage says is_numeric
is deprectaed and I shall user validate_legacy. But
<% if validate_legacy(Numeric, 'validate_numeric', $subsetting) { -%>
Error: Could not retrieve catalog from remote server: Error 500 on
SERVER: Server Error: Evaluation
Hi,
common.yaml:
variable:
baculaWorkingDirectory: '/var/lib/bacula'
variables:
baculaWorkingDirectory: '/var/lib/bacula'
config.pp:
[...]
$variables = lookup({
"name" => "variables",
"merge" => {
"strategy" => "deep",
"knockout_prefix" => "--",
# "sort_merged_arra
Jo Rhett wrote:
> Well the exact answer to your question is:
>
> lookup("roles::${category}::${class}::classes", Array,
> 'unique').include()
>
> However, the code you've shown is implementing a hierarchy for class
> assignment duplicative of the Hiera hierarchy. Why not use Hiera's
> hierarchy
Helmut Schneider wrote:
> common.yaml:
> variable:
> baculaWorkingDirectory: '/var/lib/bacula'
>
> variables:
> baculaWorkingDirectory: '/var/lib/bacula'
>
> config.pp:
> [...]
> $variables = lookup({
> "name"
Henrik Lindberg wrote:
> If your data looks like this:
>
> >> variables:
> >>baculaWorkingDirectory: '/var/lib/bacula'
>
> Then you do not have a variables.debug key - you can lookup
> variables, or variables.baculaWorkingDirectory
common.yaml:
---
netconfig:
variables:
debug:
Henrik Lindberg wrote:
> You cannot give arguments to lookup as an interpolation function
> inside of data. Use the commented out variant. Then use
> lookup_options (in your data) to configure that lookup of 'variables'
> should always be a 'deep' merge.
Great, works now, thanks a lot!
--
You r
Hi,
I want to exec something with a variable. If found the following link
and tried to implement:
https://stackoverflow.com/questions/33557093/puppet-notify-a-class-with-parameters
file { "${apacheConfPath}/conf-available/${file}":
mode => '0640',
owner => $rootUID,
Ben Ford wrote:
> Sure. When you make a reference (the upper case File syntax), it has
> to point to a thing that exists. The reference is a resource type
> (File) and a resource title (99-status.conf), but you've not defined
> a resource with that title. Basically, it's like making a symlink to
>
Hi,
I want to resolve a hostname via a custom fact:
require "resolv"
Facter.add("puppet_master_ip") do
setcode do
Resolv::DNS.open(:nameserver => ['8.8.8.8']) do |dns|
ip = dns.getaddresses("www.puppet.org")
end
end
end
How do I get the output? I just want to get the first IP.
Ben Ford wrote:
> > I want to resolve a hostname via a custom fact:
> > require "resolv"
> > Facter.add("puppet_master_ip") do
> > setcode do
> > Resolv::DNS.open(:nameserver => ['8.8.8.8']) do |dns|
> > ip = dns.getaddresses("www.puppet.org")
> > end
> > end
> > end
> > How do I
Hi,
I want to edit a YAML file:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
dhcp6: yes
Id like to add a line:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
dhcp6: yes
dhcp-identifier: mac
How can I do
Hi,
hiera.conf:
:hierarchy:
- nodes/%{::fqdn}
- apps/apache
- common
apache.yaml:
---
lookup_options:
variables:
merge:
strategy:"deep"
knockout_prefix: "--"
[...]
profiles:
webserver:
apache:
server:
configfiles:
enable:
0
Helmut Schneider wrote:
> hiera.conf:
> :hierarchy:
> - nodes/%{::fqdn}
> - apps/apache
> - common
>
> apache.yaml:
> ---
> lookup_options:
> variables:
> merge:
> strategy:"deep"
> knockout_prefix: &qu
Ben Ford wrote:
> The https://forge.puppet.com/fiddyspence/hash_file module makes it
> very easy to manage yaml files.
Will check. Thank you.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving ema
Hi,
before I reinvent the wheel:
Does anyone know a custom fact that returns the version of an installed
package (if it is installed)?
I assume it would be something like
Facter.add(:package_version) do
setcode do
osfamily = Facter.value(:osfamily)
case osfamily
when /ubuntu|debia
Ben Ford wrote:
> To be sure, this pattern doesn't always work and you don't always have
> control over the full system. What's your use case that you're trying
> to solve?
if $operatingsystem == "Ubuntu" {
if versioncmp($facts['os']['release']['full'], '18') >= 0 {
file { "/etc/netplan/win
Chris Taylor wrote:
> if $operatingsystem == "Ubuntu" {
> if versioncmp($facts['os']['release']['full'], '18') >= 0 {
> package { 'netplan':
> ensure => present,
> }
> file { "/etc/netplan/windows-dhcp.yaml":
> mode=> '0644',
> owner => "${rootUID}",
>
jcbollinger wrote:
> On Thursday, May 16, 2019 at 10:50:45 AM UTC-5, Helmut Schneider
> wrote:
>
> > I don't want to install netplan but if it exists do the needful:
>
> I reiterate Ben Ford's comments: This is generally considered an
> anti-pattern.
>
Hi,
I hope I can descripe the challenge.
/etc/puppetlabs/code/environments/production/manifests/nodes.pp:
node default {
include common
}
/etc/puppetlabs/code/modules/common/manifests/init.pp:
class common inherits config {
include $classes
[...]
/etc/puppetlabs/code/modules/config/manifest
Christopher Wood wrote:
> Top post, I'm not skilled enough to read this hence not sure where I'd
> interject. You may be better off using simpler constructs so that
> people with a wider variety of skill levels in your organization can
> contribute.
>
> What problems are you encountering where de
'Prentice Bisbal' via Puppet Users wrote:
> I'm trying to use bash to create custom facts that are booleans,
> Unfortunately, when I do, the values are interpreted as strings, and
> not booleans. For example, here is my bash script, gdm.sh:
>
> #!/bin/bash
>
> PATH=/usr/bin:/bin:/usr/sbin:/sbin
Hi,
can I order Execs in a notify?
exec { "Request $quality certificate for $letsencryptCommonName
(SAN: ${join(sort($letsencryptDnsNames), ',')})":
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin',
onlyif => "$requestOnlyif",
command => "$reques
Hi,
I want to copy a file if a diff fails:
exec { "Private key
'${letsencryptConfPath}/live/${letsencryptCommonName}/privkey.pem'
changed, updating":
path=> '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin',
command => "$copyPrivateCommand",
unless => "diff -q
${letsencryptCon
Bart-Jan Vrielink wrote:
> I cannot fully understand what you are trying to do, as I do not know
> what $copyPrivateCommand is, but I would advice against using an exec
> for copying a file, but just use a file resource instead:
$copyPrivateKeyCommand = "cp -L
${letsencryptConfPath}/live/${letsen
Bart-Jan Vrielink wrote:
> file {
> "${letsencryptConfPath}/live/${letsencryptCommonName}/privkey.pem":
> ensure => file, source =>
> "${appEtcConfPath}/ssl/private/${letsencryptCommonName}.letsencrypt.${
> letsencryptKeySize}.key", notify => Exec['/usr/local/bin/apache.sh
> -c restart'],
Hi,
I want to set some values in sshd_config. Example:
KexAlgorithms
curve25519-sha...@libssh.org,diffie-hellman-group-exchange-sha256
keys($sshdCfg).each |String $comment| {
augeas { "$file: $comment":
context => $sshdCfg[$comment]['context'],
changes => [ $sshdCfg[$comment]['changes'
Hi,
using Puppet 5.5 and Hiera 3.4.6:
common.yaml:
profiles:
webserver:
apache:
server:
modules:
enable:
- mpm_event
- status
host.yaml:
profiles:
webserver:
apache:
server:
modules:
enable:
- header
Am 07.03.2020 um 19:00 schrieb Becca Robinson:
I just ran through some testing and try putting single quotes around
your --mpm_event in Hiera.
host.yaml:
profiles:
webserver:
apache:
server:
modules:
enable:
- headers
- include
Am 07.03.2020 um 19:00 schrieb Becca Robinson:
I just ran through some testing and try putting single quotes around
your --mpm_event in Hiera.
host.yaml:
profiles:
webserver:
apache:
server:
modules:
enable:
- headers
- include
-
Am 09.03.2020 um 16:48 schrieb Becca Robinson:
What version of Puppet?
helmut@h2786452:~$ puppet -V
5.5.18
helmut@h2786452:~$ hiera -V
3.4.6
helmut@h2786452:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 18.04.4 LTS
Release:18.04
Codename:
Am 09.03.2020 um 18:36 schrieb Henrik Lindberg:
On 2020-03-07 17:53, Helmut Schneider wrote:
Why isn't mpm_event being removed?
You are running into this: https://tickets.puppetlabs.com/browse/PUP-7428
What is the preferred way to handle this? Should one write his/her own code?
-
Hi,
I'm using something like this:
netconfig:
hostname:'BSDHelmut'
interfaces:
"%{facts.networking.primary}":
ip4: &ip4 '192.168.124.35'
cidr4:&cidr4 '192.168.124.35/24'
ip4aliases:
- '192.168.124.36/32'
ip6: &ip
Hi,
class abc {
keys($netconfig['interfaces']).each |String $interface| {
if $netconfig['interfaces'][$interface]['ip6'] {
$myvariable = 'yes'
break()
}
}
if $myvariable == 'yes' {
do something
}
}
How can I access $myvariable?
Thank you!
--
You received this m
Am 19.03.2020 um 22:54 schrieb Henrik Lindberg:
On 2020-03-19 22:11, Helmut Schneider wrote:
Hi,
class abc {
keys($netconfig['interfaces']).each |String $interface| {
if $netconfig['interfaces'][$interface]['ip6'] {
$myvariable = 'yes
Hi,
helmut@puppet:~$ sudo puppet lookup --node mynode roles
helmut@puppet:~$
Good because does not exist.
class common inherits config {
include $classes
if ($roles) {
keys($roles).each |String $role| { <== line9
[...]
Error: Could not retrieve catalog from remote server: Error 500 on
Am 17.06.2020 um 13:10 schrieb Helmut Schneider:
helmut@puppet:~$ sudo puppet lookup --node mynode roles
helmut@puppet:~$
Good because does not exist.
class common inherits config {
include $classes
if ($roles) {
keys($roles).each |String $role| { <== line9
[...]
Error: Co
Am 17.06.2020 um 15:01 schrieb 'Dirk Heinrichs' via Puppet Users:
Am Mittwoch, den 17.06.2020, 13:37 +0200 schrieb Helmut Schneider:
Can I check if an array has elements?
if size($something) > 0 {}
Found $array.empty but thank you.
--
You received this message because you a
Hi,
I want to put values ordered in (here) sshd_config. I tried with
ins...after but get only errors:
'sshd_config PrintMotd':
context: '/files/etc/ssh/sshd_config'
changes:
- 'set PrintMotd yes'
'sshd_config PasswordAuthentication':
context: '/files/etc/ssh/sshd_config'
changes:
Hi,
/etc/puppetlabs/code/modules/amavisd/manifests/init.pp
ensure_resource('exec', '/usr/local/bin/amavisd.sh -sP', {
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin',
refreshonly => true,
command => 'su -l root -c "/usr/local/bin/amavisd.sh -sP"',
})
One client reports:
Server Err
Am 10.09.2020 um 08:10 schrieb Andreas Dvorak:
epp file
<%- |
Hash database_conf,
| -%>
Hash $databse_conf
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to pu
Hi,
as /opt/puppetlabs/server/data/puppetserver/reports/ is filling up, what
are those reports used for? I read that I can purge them but want to
understand the purpose of those reports before doing so. I use puppetdb
if that is important.
Thank you!
--
You received this message because you
Am 26.11.2020 um 10:19 schrieb 'Dirk Heinrichs' via Puppet Users:
Am Donnerstag, den 26.11.2020, 09:37 +0100 schrieb Helmut Schneider:
as /opt/puppetlabs/server/data/puppetserver/reports/ is filling up, what
are those reports used for?
Errh, for checking what's going on in y
Am 26.11.2020 um 12:04 schrieb 'Dirk Heinrichs' via Puppet Users:
Am Donnerstag, den 26.11.2020, 11:46 +0100 schrieb Helmut Schneider:
Am 26.11.2020 um 10:19 schrieb 'Dirk Heinrichs' via Puppet Users:
Am Donnerstag, den 26.11.2020, 09:37 +0100 schrieb Helmut Schneider:
Hi,
after update of puppet-agent on Ubuntu I get the following error:
Debug: Facter: Query is operatingsystem
Debug: Facter: Checking query tokens operatingsystem
Debug: Facter: List of resolvable facts:
[#@fact_class=Facts::Linux::Os::Name, @filter_tokens=[],
@user_query="operatingsystem", @t
Am 08.12.2020 um 13:15 schrieb Bogdan Irimie:
Facter 4 resolves each fact on a separate thread, this can lead to a
high number of threads being created. Can you please provide the output
of `cat /proc/sys/kernel/threads-max` on the system where you see this
issue? Does this happen at every run
Am 08.12.2020 um 14:45 schrieb Helmut Schneider:
Am 08.12.2020 um 13:15 schrieb Bogdan Irimie:
Facter 4 resolves each fact on a separate thread, this can lead to a
high number of threads being created. Can you please provide the output
of `cat /proc/sys/kernel/threads-max` on the system where
Hi,
I need to fill an array in a loop. While I understand variable scoping I
found some information that it is possible.
https://stackoverflow.com/questions/41041549/puppet-adding-array-elements-in-a-loop/41047623
https://blog.thewatertower.org/2019/04/15/building-or-appending-to-an-array-usin
Am 10.01.2022 um 08:04 schrieb 'Dirk Heinrichs' via Puppet Users:
Am Sonntag, dem 09.01.2022 um 15:31 +0100 schrieb Helmut Schneider:
Unfortunately I'm not able to adapt it to my needs:
$array = []
[1, 2, 3].each |$variable| {
add $variable to $array
}
Any tips?
The first
Am 10.01.2022 um 15:55 schrieb 'Dirk Heinrichs' via Puppet Users:
> Am Montag, dem 10.01.2022 um 14:29 +0100 schrieb Helmut Schneider:
>
>> I'm afraid I still do not unterstand this correctly:
>>
>> profiles:
>>vpn:
>> open
Am 10.01.2022 um 18:07 schrieb Karsten Heymann:
Hi Helmut,
you could take this as a starting point (untested):
$profile_logging = $profiles.map | $p_name, $p_data | { $p_data.map |
$s_name, $s_data | { $s_data['syslog'] } }.flatten
p_ is the outer profile layer, s_ is the inner service layer.
Hi,
common.yaml:
---
lookup_options:
paths:
merge:
strategy: 'deep'
knockout_prefix: '--'
variables:
merge:
strategy: 'deep'
knockout_prefix: '--'
paths:
logfilePath: '/var/log'
[...]
another.yaml:
lookup_options:
paths:
merge
Hi,
my hiera.yaml:
---
version: 5
defaults:
datadir: /etc/puppetlabs/code/environments/%{::environment}/hieradata
data_hash: yaml_data
hierarchy:
- name: "Nodes"
path: "nodes/%{::fqdn}.yaml"
- name: "Domains"
globs:
- "domains/%{::domain}/*.yaml"
- name: "Operatin
Am 24.03.2022 um 15:18 schrieb Tim Skirvin:
Helmut Schneider writes:
paths:
- "%{::operatingsystem}-%{::operatingsystemrelease}.yaml"
- "%{::operatingsystem}-%{::virtual}.yaml"
- "%{::operatingsystem}.yaml"
- "%{::kernel}.yaml&qu
80 matches
Mail list logo