Giter VIP home page Giter VIP logo

voxpupuli / puppet-system Goto Github PK

View Code? Open in Web Editor NEW
65.0 48.0 47.0 304 KB

Manage Linux system resources and services from hiera configuration

Home Page: https://forge.puppet.com/puppet/system

License: Apache License 2.0

Puppet 56.70% Ruby 24.63% Perl 15.36% HTML 2.28% Dockerfile 1.02%
linux-puppet-module puppet hacktoberfest centos-puppet-module debian-puppet-module opensuse-puppet-module oraclelinux-puppet-module redhat-puppet-module scientific-puppet-module sles-puppet-module

puppet-system's Introduction

This module is deprecated. Do not use it anymore

Transferred to the good people at Vox Pupuli.

puppet-system

License Build Status Puppet Forge Puppet Forge - downloads Puppet Forge - scores

Manage Linux system resources and services from hiera configuration.

Please take note that this module works only with RedHat like systems.

  • augeas: apply file changes using the augeas tool
  • crontabs: set user crontab entries
  • execs: run idempotent external commands
  • facts: set custom facts
  • files: create/update files or directories
  • groups: manage entries in /etc/group
  • hosts: manage entries in /etc/hosts
  • limits: manage entries in /etc/security/limits.conf
  • mail manage entries in /etc/aliases or set a relay host
  • mounts: manage entries in /etc/fstab
  • network: configure basic networking and dns
  • ntp: configure NTP servers in /etc/ntp.conf
  • packages: manage system packages
  • schedules: determine when resource config should not be applied and how often
  • selbooleans: manage SELinux booleans
  • services: manage system services
  • sshd: manage configuration in /etc/ssh/sshd_config including subsystems like sftp
  • sysconfig: manage files under /etc/sysconfig: clock, i18n, keyboard, puppet-dashboard, puppet, puppetmaster, selinux
  • sysctl: manage entries in /etc/sysctl.conf
  • templates: create files from ERB templates
  • users: manage users in /etc/passwd and /etc/shadow
  • yumgroups: manage system package groups
  • yumrepos: manage yum repository files under /etc/yum.repos.d

Documentation

For default types (users, groups, mounts, yumrepos, packages, cron, exec) see the documentation at http://docs.puppetlabs.com/references/latest/type.html for the parameters that can be passed to each of the resources.

For augeasproviders types (sysctl, sshd) see http://forge.puppetlabs.com/domcleal/augeasproviders.

For limits see http://forge.puppetlabs.com/erwbgy/limits.

Usage

Include the system module in your puppet configuration:

include system

and add required hiera configuration.

Note: To exclude certain system classes when doing 'include system' you can set their schedule parameter to 'never'. This may be useful when testing or debugging issues or just to prevent config lower in the hierarchy being applied.

For example:

system::packages::schedule:  'never'
system::yumgroups::schedule: 'never'

will ignore any configuration for system::packages and system::yumgroups.

augeas

Apply changes to files using the augeas tool. This enables simple configuration file changes to be made without writing new classes.

Example 1:

system::augeas:
  'ntp':
    context: '/files/etc/ntp.conf'
    changes:
      - 'set server[1] 0.uk.pool.ntp.org'
      - 'set server[2] 1.uk.pool.ntp.org'
      - 'set server[3] 2.uk.pool.ntp.org'

Example 2:

system::augeas:
  'test1':
    context: '/files/etc/sysconfig/firstboot'
    changes:
      - 'set RUN_FIRSTBOOT YES'
    onlyif:  'match other_value size > 0'

Example 3:

system::augeas:
  'jboss_conf':
    context: '/files'
    changes:
      - 'set etc/jbossas/jbossas.conf/JBOSS_IP $ipaddress'
      - 'set etc/jbossas/jbossas.conf/JAVA_HOME /usr'
    load_path: '/usr/share/jbossas/lenses'

Defaults:

  • ensure: present
  • user: root

crontabs

Set user crontab entries

Example configuration:

system::crontabs:
  'root-logrotate':
    command: '/usr/sbin/logrotate'
    user:    'root'
    hour:    '2'
    minute:  '0'

Defaults:

  • ensure: present
  • user: root

execs

Run idempotent external commands

Example configuration:

system::execs:
  '/bin/mkdir -p /apps/tomcat1/deploy':
    unless:  '/usr/bin/test -d /apps/tomcat1/deploy'
  "/usr/bin/perl -pi -e 's: grep 1.6: egrep \"1.6/1.7\":' /apps/wso2esb1/product/wso2esb/bin/wso2server.sh":
    onlyif: '/bin/grep -w "grep 1.6" /apps/wso2esb1/product/wso2esb/bin/wso2server.sh'

Note: The commands will be run on every Puppet run unless you specify 'onlyif', 'unless' or 'refreshonly' parameters.

facts

Set custom facts using the facter_dot_d Facter plugin that loads facts from /etc/facter/facts.d (https://github.com/ripienaar/facter-facts/tree/master/facts-dot-d)

Example configuration:

system::facts:
  location:
    value: 'London'
  ntpq:
    type:  'script'
    value: "#!/bin/bash\nprintf ntpq=\n/usr/sbin/ntpq -p | /usr/bin/tail -1\n"

These facts can be queried on a host using 'facter -p':

$ facter -p location
London
$ facter -p ntpq
*10.43.4.8       158.43.128.33    2 u  820 1024  377    0.538    0.155   0.048

Set:

system::facts::cleanold: true

to remove facts from the old locations under /etc/profile.d and in /etc/sysconfig/puppet.

files

Create or update files or directories

Example 1 - create a mount point for an NFS mounted directory:

system::files:
  /apps:
    ensure:  'directory'
    owner:   'root'
    group:   'root'
    mode:    '0755'

Example 2 - create a file with the given content:

system::files:
  /etc/motd:
    ensure:  'present'
    owner:   'root'
    group:   'root'
    mode:    '0644'
    content: "Authorised access only\nIf unauthorised log off now or face prosecution\n"

Note: Use double-quotes if your content contains embedded newlines (\n) or tabs (\t). Normally you will also want a terminating newline.

groups

Manage entries in /etc/group

Example configuration:

system::groups:
  'sysadmins':
    ensure: 'present'
    gid:    '1500'
  'ops':
    gid:    '1503'
system::groups::realize:
  - 'keith'

Defaults:

  • ensure: present

By default virtual group resources are created that must then be realized. To create real resources instead (as with earlier versions of this module) use:

system::groups::real: 'true'

hosts

Manage entries in /etc/hosts

Example configuration:

system::hosts:
  puppet:
    ensure:       'present'
    ip:           '10.5.11.19'
    host_aliases: [ 'puppet.local' ]

Defaults:

  • ensure: present

See: http://docs.puppetlabs.com/references/latest/type.html#host

limits

Manage entries in /etc/security/limits.conf

Example configuration:

system::limits:
  '*':
    nofile:
      soft: 1024
      hard: 2048
  '@weblogic':
    nofile:
      soft: 16384
      hard: 16384
    nproc:
      soft: 2048
      hard: 2048

No defaults.

mail

Manage entries in /etc/aliases or set a relay host

Example configuration:

system::mail:
  aliases:
    postmaster:
      recipient: 'root'
    webmaster:
      recipient: '[email protected]'
  relayhost:     'mail.domain.com'
  type:          'postfix'

No defaults.

See: http://docs.puppetlabs.com/references/latest/type.html#mailalias

Currently only 'postfix' is supported for setting a relay host.

mounts

Manage entries in /etc/fstab

Example configuration:

system::mounts:
  '/home':
    ensure:  'mounted'
    device:  '/dev/mapper/vg_x120-lv_home'
    atboot:  'true'
    fstype:  'ext4'
    options: 'defaults'

Defaults:

  • atboot: true
  • ensure: mounted

Note: These resources are created last so any required users, groups or mount point directories have a chance to be created first.

network

Configure basic networking: set hostname, enable/disable zeroconf/IPv6, set the default route, configure interfaces and their static routes, configure nameserver resolvers and domains

Example configuration:

system::network::hostname: 'puppet.domain.com'
system::network::gateway:  '10.7.0.1'
system::network::ipv6:     'false'
system::network::zeroconf: 'false'
system::network::dns:
  nameservers: [ '10.7.96.2', '10.7.96.2' ]
  domains:     [ 'domain.com', 'sub.domain.com' ]
system::network::interfaces:
  eth0:
    ipaddress: '10.7.96.21'
    netmask:   '255.255.240.0'
    routes:
      '10.0.0.0/8':
        via: '10.16.0.250'

ntp

Manage NTP servers in /etc/ntp.conf

Example 1:

system::ntp::iburst:  'true'
system::ntp::servers: [ 'ntp1.example.com' ]

Example 2:

system::ntp::iburst:  'true'
system::ntp::country: 'uk'

See https://github.com/erwbgy/puppet-ntp for more details

Note: The NTP algorithm does not work properly with two NTP servers.

packages

Manage system packages

Example configuration:

system::packages:
  AdobeReader_enu:
    ensure: '9.5.1-1'
  ConsoleKit:
    ensure: '0.4.5-2.fc17'

Defaults:

  • ensure: installed

schedules

Create schedules that determine when a resource should not be applied and the number times it should be applied within a specified time period.

Example configuration:

system::schedules:
  'maintenance':
    range:  '2 - 4'
    period: 'daily'
    repeat: 1
  'half-hourly':
    period: 'hourly'
    repeat: 2

The defined schedules can then be passed using the 'schedule' parameter to other types.

Example 1:

system::schedule: 'maintenance'

sets the default schedule for all system resources so that they are only run during the maintenance window of 2:00 to 04:59.

Example 2:

system::services::schedule: 'daily'

sets the default schedule for all system::services resources to be once a day.

Example 3:

system::services:
  httpd:
    ensure: 'running'
    enable: 'true'
    schedule: 'half-hourly'

overrides the services schedule for the httpd resource using a custom schedule we defined above.

The default Puppet schedules are:

  • daily
  • hourly
  • monthly
  • never
  • weekly

and the system::schedule class defines another called always that schedules the resource on every Puppet run.

selbooleans

Manages SELinux booleans

Example configuration:

system::selbooleans:
  'httpd_can_network_connect':
    value: 'on'
    persistent: 'true'

Defaults:

  • persistent: false

services

Manage system services

Example configuration:

system::services:
  cups:
    ensure: 'stopped'
    enable: 'false'
  sshd:
    ensure: 'running'
    enable: 'true'
  ntpd:
    ensure: 'running'
    enable: 'true'

Defaults:

  • ensure: running

Note:

  • Do not specify any services that are managed by other Puppet modules (eg. ntpd or network) otherwise you may get conflicts

sshd

Manage settings in /etc/ssh/sshd.conf

Synchronize host keys file entries across all puppet-managed hosts.

Example configuration:

system::sshd:
  AllowGroups:
    value:     [ 'sshusers', 'admin' ]
  PermitRootLogin:
    value:     'without-password'
    condition: 'Host example.net'

system::sshd::subsystem:
  sftp:
    command: '/usr/libexec/openssh/sftp-server -u 0002'

system::sshd::sync_host_keys: 'true'

No defaults.

See:

sysconfig

Manage settings in files under /etc/sysconfig

Example configuration:

system::sysconfig::clock:
  timezone: 'Europe/London'

system::sysconfig::i18n:
  # Run 'locale -a' to see possible lang values
  lang: 'en_GB.utf8'

system::sysconfig::keyboard:
  keytable:     'uk'
  model:        'pc105'
  layout:       'gb'
  keyboardtype: 'pc'

system::sysconfig::puppet:
  server: 'puppet.sbet'

system::sysconfig::selinux:
  state: 'enforcing'

No defaults.

Note: Values must not contain whitespace

sysctl

Manage settings in /etc/sysctl.conf

Example configuration:

system::sysctl:
  kernel.msgmnb:
    value: '131072'
    comment: 'Controls the default maximum size of a message queue'
  kernel.msgmax:
    value: '131072'
    comment: ' Controls the maximum size of a message, in bytes'

No defaults.

See:

Note: Quote numeric values to avoid "can't convert Fixnum into String" errors

templates

Create files from ERB templates

Example configuration:

system::templates:
  /etc/motd:
    owner:    'root'
    group:    'root'
    mode:     '0644'
    template: "/var/lib/puppet/templates/motd-%{osfamily}.erb"
  /etc/environment:
    owner:    'root'
    group:    'root'
    mode:     '0644'
    template: "environment.erb"

Default:

  • owner: root
  • group: root

If template is a relative path then Puppet will look for template file in template_dir (eg. /var/lib/puppet/templates).

Templates can use any facts set for the destination host.

users

Manage users entries in /etc/passwd and /etc/shadow

Example configuration:

system::users:
  'keith':
    ensure:    'present'
    comment:   'Keith Burdis'
    gid:       '500'
    groups:    ['wheel']
    home:      '/home/keith'
    shell:     '/bin/bash'
    uid:       '500'
  'fred':
    comment:   'Fred Bloggs'
    uid:       '503'
    gid:       '503'
    home:      '/home/fred'
    managehome: true
system::users::realize:
  - 'keith'

Defaults:

  • ensure: present
  • shell: /bin/bash

By default virtual user resources are created that must then be realized. To create real resources instead (as with earlier versions of this module) use:

system::users::real: 'true'

yumgroups

Manage system package groups

Example configuration:

system::yumgroups:
  'Base':
    ensure: 'present'
  'Console internet tools':
    ensure: 'present'
  'Perl Support':
    ensure: 'present'
    usecache: false
  'Ruby Support':
    ensure: 'present'
    optional: true
    usecache: false

Defaults:

  • optional: false
  • usecache: true
  • schedule: daily

Note: Set 'usecache: false' if 'yum -C grouplist' does not work on your system and you are getting System::Yumgroup resources created on every Puppet run

Note: By default the yumgroup type has a 'daily' schedule to reduce the time Puppet runs take - package group changes are usually rare after the host is first set up. This means that it will run once every 24 hours. You override this by supplying your own schedule parameter - see system::schedules to create your own custom schedules.

yumrepos

Manage yum repository files under /etc/yum.repos.d

Example configuration:

system::yumrepos:
  'puppetlabs-deps':
    baseurl:  'http://yum.puppetlabs.com/fedora/f17/dependencies/$basearch'
    descr:    'Puppet Labs Dependencies Fedora 17 - $basearch'
    enabled:  '1'
    gpgcheck: '1'
    gpgkey:   'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs'
  'puppetlabs-products':
    baseurl:  'http://yum.puppetlabs.com/fedora/f17/products/$basearch'
    descr:    'Puppet Labs Products Fedora 17 - $basearch'
    enabled:  '1'
    gpgcheck: '1'
    gpgkey:   'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs'

Defaults:

  • enabled: 1
  • gpgcheck: 1

providers

The augeasproviders module can be an alternate provider for the host, mailalias and mounttab types.

Example configuration:

system::providers:
  host: 'augeas'
  mailalias: 'augeas'
  mounttab: 'augeas'

Notes

  • Do not specify resources that are managed by other Puppet modules otherwise you will get conflict errors.

  • As with many default types you can often specify a 'target' parameter to specify a different configuration filename to change.

puppet-system's People

Contributors

alexjfisher avatar bastelfreak avatar dhollinger avatar dhoppe avatar ekohl avatar erwbgy avatar florianfa avatar juniorsysadmin avatar llowder avatar marcw avatar masonm avatar sandra-thieme avatar skroes avatar smortex avatar tragiccode avatar wyardley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-system's Issues

system::schedule default 'always' will not run between the hours of 23:00-00:00

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.16.0
  • Ruby: ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux]
  • Distribution: CentOS 7.9.2009
  • Module version: 0.8.2

How to reproduce (e.g Puppet code you use)

/etc/puppetlabs/code/environments/production/data/common.yaml:

system::templates:
  /etc/motd:
    owner: root
    group: root
    mode: '0644'
    template: '/etc/puppetlabs/code/environments/production/site/profile/templates/motd.erb'

/etc/puppetlabs/code/environments/production/site/profile/templates/motd.erb

# Hostname              : <%= @fqdn %>
####################################
I've read & consent to terms in IS user agreem't.

What are you seeing

File is not updated between the hours of 23:00 to 00:00. I believe this is due to the following line:

range => '0 - 23',

If I change that line to range => '0:00 - 23:59', it executes correctly.

What behaviour did you expect instead

File contents to be replaced with template

Output log

Any additional information you'd like to impart

System calls any ntp provider which has been installed.

The system module currently requires a very minimal ntp provider. There are many, many other ntp providers which have significantly more features. Please make your module optional for this, not required.

Furthermore, the ntp.pp manifest invokes any top-level ntp class, which can lead to confusing and hilarious results.

If you really want to include ntp, why not remove the dependency from Moduleinfo and just require that any top-level ntp module be installed and pass all options through to it? You're pretty much there already. You could just blindly pass all parameters through, and thus allow the user to use any ntp module they want --yours or someone else's.

Update module to support puppet 6

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.0.4-1stretch
  • Ruby: ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
  • Distribution: Debian 9
  • Module version: 0.8.2

How to reproduce (e.g Puppet code you use)

Hiera_hash (all hiera_* functions)
This function is deprecated in favor of the lookup function. While this function continues to work, it does not support:

lookup_options stored in the data
lookup across global, environment, and module layers

What are you seeing

The data merge doesn't work across the hiera data layer. (environment->module layer). It can only lookup the environment data. Module data doesn't work.

What behaviour did you expect instead

Cam merge global->environment->module data layer

Output log

Any additional information you'd like to impart

I can replace https://github.com/voxpupuli/puppet-system/blob/master/manifests/users.pp
$hiera_config = hiera_hash('system::users', undef)
by
$hiera_config = lookup( { 'name' => 'system::users',
'merge' => {
'strategy' => 'deep',
},
})
The lookup then fine.
So you need to replace all hiera_* functions by lookup function I guess.

Installing a package that requires epel

Hi,

So I'm using hiera as per some of the examples, and attempting to install a package but that package requires EPEL be installed first. I seem to have found myself in a bit of a loop, or maybe misunderstanding of how require should work.

Basic hiera snippet:

site.pp:

node default {
  include stdlib
  hiera_include('classes','')
}

myhost.yaml:


---
classes: [' system ']

system::yumrepos:
   epel:
      mirrorlist: 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-${::os_maj_version}&arch=\$basearch'
      gpgcheck: '0'
      enabled: '1'

redis:
    ensure: installed
    require: Yumrepo[ 'epel' ]

When I run puppet agent on a client, I get:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid relationship: Package[redis] { require => Yumrepo[ epel ] }, because Yumrepo[ epel ] doesn't seem to be in the catalog

My assumption is that because im pointing a require at a Yumrepo, but its being defined in hiera, it doesnt see it in the catalog?

Any advice?

system::ntp class faulty, iburst not found

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet Server/client:latest

How to reproduce (e.g Puppet code you use)

in hiera:
system::ntp::servers:

  • 1.2.3.4
  • 3.4.4.5

in module:
include system::ntp

What are you seeing

Error while evaluating a Resource Statement, Class[Ntp]: has no parameter named 'iburst'

systctl is broken with new augeasproviders

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6
  • Ruby:
  • Distribution:
  • Module version:

How to reproduce (e.g Puppet code you use)

What are you seeing

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::augeasproviders for (file: /etc/puppetlabs/code/environments/development/modules/system/manifests/sysctl.pp, line: 15, column: 7) on node

What behaviour did you expect instead

Output log

Any additional information you'd like to impart

Virtual packages

Consider making system::packages virtual like users and groups. They can then be declared in one place and realized as many times as required which should help to avoid conflicts and messy 'if defined' checks.

system::network for mulitple nodes?

I am a bit new to hiera. Does anyone know if it's possible to use system::network when you need to set the network IP on multiple nodes(cluster) being pulled from hiera like my example below?? Is there a way to accomplish this using this module?

I was hoping for something like this:

system::network:
server1:
interface: 'eth0'
ipaddress: '10.10.10.10'
netmask: '255.255.255.0'
server2:
interface: 'eth0'
ipaddress: '10.10.10.20'
netmask: '255.255.255.0'

include system

if you just do a include system as the documentation suggests you run into some trouble.

e.g.

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Must pass gateway to Class[System::Network] at /etc/puppet/modules/system/manifests/init.pp:74

// Michael

ipv6 manual config in network interfaces.

It would be nice to have the option to also include these variables in ifcfg-ethX for ipv6 manual configuration.

IPV6INIT=yes
USERCTL=no
IPV6_AUTOCONF=no
IPV6ADDR=
IPV6ADDR_SECONDARIES=

network/dns template is completely wrong (options, search)

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: all
  • Ruby: all
  • Distribution: latest
  • Module version: all

Problem description

Problem affects any users of system::network::dns: with search or options.

The template is incorrect and produces bad results. The results of the following hiera:

system::network::dns:
  nameservers: [ 8.8.8.8 ] 
  domains:
    - internal.domain.eu
    - domain.eu
  options:
    - optionA
    - optionB

produces the following resolv.conf, which is incorrect format of a resolv.conf:

# File managed by Puppet
nameserver 8.8.8.8
search internal.domain.eu
search domain.eu
options optionA
options optionB

This is incorrect behavior and will result in the first search and first options from being ignored. That is, in the above case, the internal.domain.edu domain will not be searched.

Rather, according to resolv.conf(5) man page, the produced file should be:

# File managed by Puppet
nameserver 8.8.8.8
search internal.domain.eu domain.eu
options optionA optionB

selinux configuration broken

system::sysconfig::selinux

Changing the state breaks the symbolic link to /etc/selinux/config which stops selinux being correctly confiigured.

setting "class: system" breaks unless subclasses have defined config

Running 3.5.1.1 and version 7.4 of the system module.

For example, if I have a node-level yaml file (just testing at this point) with nothing but this:

class:

  • "system"

I get this error with the node's client runs:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item system::augeas in any Hiera data file and no default supplied at /etc/puppet/modules/system/manifests/augeas.pp:12 on node jobs-6f-vm-01q.xxx.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

This remains the case if I set system::augeas::schedule: 'never' in the node's yaml or in common.yaml, or if I include system in the site.pp instead of in hiera.

To get around this I can set the class to the submodule I want to use, e.g. system::augeas and then ensure that I have at least one config defined.

My expectation is that I can include all of system for my nodes and then enable modules by creating configs at the relevant point in my hiera hierarchy.

Is this a a bug or am I guilty of improper usage? Thanks.

service cannot be subscribed after template is applied due to ordering enforcement

Hi,
The idea is to update a config file using a system::templates resource that triggers a system::services resource via subscribe, but it fails as system::templates is in last stage and cannot be applied before system::services.

Example of a hiera yaml to show the limitation:
system::templates:
'/etc/ssh/sshd_config':
owner: 'root'
group: 'root'
mode: '0600'
template: "system/sshd_config.erb"
system::services:
'sshd':
ensure: 'running'
subscribe: 'File[/etc/ssh/sshd_config]'

To fix the issue we updated init.pp and made system::services to be ordered in the last stage as well, but I would like to understand the reason why system::templates is ordered in the last stage and services is not?
Regards,
Rafael

sysctl live updates

The system::sysctl configuration currently only updates /etc/sysctl.conf. It should also check the current sysctl settings and dynamically update them if required.

system::files templates

Add support for processing templates in content values as you can with normal file resources.

RHEL 7 mismatching dependencies and lookup failure

Hi all,
Thanks for the updates to this module, unfortunately we're experiencing some difficulties. It appears the install of 0.8.0 doesn't work on Redhat, we get a message "Error: Could not install module 'puppet-system' (???) No version of 'puppet-system' can satisfy all dependencies"

I've tried to locate the required dependencies but herculesteam-augeasproviders seems really old, when specifying 1.0.0 on the puppet module install command it returns saying one can't be found.

[root@dbsms01 puppet]# puppet module list --tree --modulepath=./modules/live/
Warning: Module 'herculesteam-augeasproviders' (v2.1.3) fails to meet some dependencies:
'puppet-system' (v0.8.0) requires 'herculesteam-augeasproviders' (>= 0.5.1 < 1.0.0)
/etc/puppetlabs/puppet/modules/live
├── facts (???)
├── profile (???)
├── role (???)
└─┬ puppet-system (v0.8.0)
├── puppetlabs-stdlib (v4.24.0)
├── puppetlabs-concat (v4.1.1)
├── erwbgy-limits (v0.3.1)
├── erwbgy-ntp (v0.7.3)
└─┬ herculesteam-augeasproviders (v2.1.3) invalid

The error we're seeing is this:

Error: Evaluation Error: Error while evaluating a Function Call, could not create resource of unknown type user at /etc/puppetlabs/puppet/modules/live/system/manifests/users.pp:23:7 on node dbsms01.test.nl.local
/etc/puppetlabs/puppet/modules/live/system/lib/puppet/parser/functions/system_create_resources.rb:66:in block in <top (required)>' /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/functions.rb:174:in block (2 levels) in newfunction'

It looks like the user resource isn't being passed or there is something missing.

Thanks

Dave

Hosts should not be ordered for me

Having this yaml:

system::hosts:
  host1:
    ip:           '1.2.3.4'
    host_aliases: [ 'system.example.com', 'system' ]
  host2:
    ip:           '1.2.3.5'
    host_aliases: [ 'site.example.com ]

It produces /etc/hosts which always contain hosts ordered from shortest to longest without keeping order specified in host_aliases. Afterall it makes puppet agent to think that domain is not set when starting as agent, because hostname resolves by shortest one (system in this example).

facter --puppet | grep domain => should be example.com

Is it a bug ? How can I guarantee the order to be as longest alias first.

Puppet agent returns an error if puppet future parser is enabled

Hello erwbgy,

If I use the future parser I will get an error:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, create_resources(): second argument must be a hash at /etc/puppet/environments/development/modules/system/manifests/yumrepos.pp:16:7 on node
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

My Env:
Puppet Master: 3.7.1
Puppet Agent: 3.7.1

Thank you.

Regards,
Florian

system::files

Hi ,

Kindly guide me to configure this in foreman 1.2 .

How I can create file on target puppet client using Foreman 1.2 using your this mudule ,actually how can I pass parameter in config

shift towards stdlib::manage

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7
  • Ruby: 3
  • Distribution: Any
  • Module version: 0.8.2

What are you seeing

stdlib 8.3.0 now includes the stdlib::manage class which can replace a lot of the specific logic in use within this module.

Error: Failed to apply catalog: Could not find schedule always

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.6
  • Ruby: 2.5.0
  • Distribution: centos
  • Module version: 0.8.2

How to reproduce (e.g Puppet code you use)

class:
class os_build::l1::hosts{
notify {"*** Applying ${name} ***":}
contain system::hosts
}

hieradate:

system::hosts:
puppet:
ensure: 'present'
ip: "10.0.0.3"
host_aliases: []

Code I've had to change to get this working is to comment out were there is "sys_schedule" as shown below

class system::hosts (
$config = undef,
# $sys_schedule = 'always',
) {
$defaults = {
ensure => 'present',
# schedule => $sys_schedule,
}
if $config {
create_resources(host, $config, $defaults)
}
else {
$hiera_config = hiera_hash('system::hosts', undef)
if $hiera_config {
create_resources(host, $hiera_config, $defaults)
}
}
}

What are you seeing

The following error message is displayed:
Error: Failed to apply catalog: Could not find schedule always

What behaviour did you expect instead

Entries added to /etc/hosts

Output log

Error: Failed to apply catalog: Could not find schedule always

Any additional information you'd like to impart

how can it configure dhcp on an interface ?

It seems it is not possible currently :

  • in templates/network/interface.erb , there are no conditionnal on IPADDR (and NETMASK)
  • in manifests/network/interface.pp , you test $ipaddress to set $_dhcp (lines 18-24) but latter, you fail if it is not a valid IP address (line 38-41)

If you like, I can submit a patch.

Possibility to add aliased interfaces

Hi, this is very basic modifications, I'm sure you can find a more elegent way to it done by still validating the mac addr, but not having it required for aliased interfaces.

Here is my svn diff, from the puppetlab module to wht i juste modified.

Index: system/manifests/network/interface.pp

--- system/manifests/network/interface.pp (revision 3)
+++ system/manifests/network/interface.pp (working copy)
@@ -25,9 +25,9 @@
else {
$hwaddr = inline_template("<%= scope.lookupvar('macaddress${_interface}') %>")
}

  • if ! is_mac_address($_hwaddr) {
  • fail('system::network::interface::hwaddr must be a MAC address')
  • }
  • #if ! is_mac_address($_hwaddr) {
  • fail('system::network::interface::hwaddr must be a MAC address')

  • #}
    $_hotplug = $hotplug
    validate_bool($_hotplug)
    $_ipaddr = $ipaddress
    Index: system/templates/network/interface.erb
    ===================================================================
    --- system/templates/network/interface.erb (revision 3)
    +++ system/templates/network/interface.erb (working copy)
    @@ -1,7 +1,7 @@

File managed by Puppet

DEVICE=<%= @_interface %>
BOOTPROTO=<% if @_dhcp %>dhcp<% else %>none<% end %>
-HWADDR=<%= @_hwaddr %>
+<% if @_hwaddr %>HWADDR=<%= @_hwaddr %><% else %><% end %>
ONBOOT=<% if @_onboot %>yes<% else %>no<% end %>
HOTPLUG=<% if @_hotplug %>yes<% else %>no<% end %>
TYPE=<%= @_type %>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.