Forge Home

helloworld

A demo puppet module, though not a good one.

1,083 downloads

910 latest version

4.5 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.1 (latest)
  • 0.1.0
released Nov 25th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'fen9li-helloworld', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add fen9li-helloworld
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install fen9li-helloworld --version 0.1.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

fen9li/helloworld — version 0.1.1 Nov 25th 2020

helloworld

This is a demo module to test out how to create, test, package and publish a custom Puppet module.

Table of Contents

  1. Description
  2. Setup - The basics of getting started with helloworld
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module

Description

If you want to learn how to create your own puppet module, this one maybe a good start.

Note 1: A short overview of the generated parts can be found in the PDK documentation.

Setup

What helloworld affects

This module makes 2 changes in the managed nodes:

  • This module will create a text file at path /tmp/foobar.txt with content foo bar.
  • This module will install chrony package, start and enable chrony NTP service

Note 2: A good Puppet module has only one area of responsibility.

Setup Requirements

None at the time of writing.

Beginning with helloworld

  • Install this module
  • Include this module in your site.pp and apply to the nodes you want to make changes

Usage

  1. ssh to your puppet server and ensure your puppetserver service is up and running
[fli@koala ~]$ ssh puppet
Last login: Wed Nov 25 15:34:13 2020 from gateway
[fli@puppet ~]$ sudo systemctl status puppetserver
● puppetserver.service - puppetserver Service
   Loaded: loaded (/usr/lib/systemd/system/puppetserver.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-11-26 10:09:17 AEDT; 1min 11s ago
  Process: 1071 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exited, status=0/SUCCESS)
 Main PID: 1597 (java)
    Tasks: 50 (limit: 4915)
   Memory: 821.3M
   CGroup: /system.slice/puppetserver.service
           └─1597 /usr/bin/java -Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger -XX:OnO...

Nov 26 10:06:54 puppet.fen9.li systemd[1]: Starting puppetserver Service...
Nov 26 10:09:17 puppet.fen9.li systemd[1]: Started puppetserver Service.
[fli@puppet ~]$ 
  1. install fen9li-helloworld module
[fli@puppet ~]$ ll /etc/puppetlabs/code/environments/production/modules/
total 16
drwxr-xr-x. 13 root root 4096 Oct  5 22:06 apache
drwxr-xr-x.  8 root root 4096 Jan 22  2020 concat
drwxr-xr-x.  9 root root 4096 Sep 30 22:56 stdlib
drwxr-xr-x.  5 root root 4096 Mar 24  2020 translate
[fli@puppet ~]$ 

[fli@puppet ~]$ sudo puppet module install fen9li-helloworld --version 0.1.0
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└── fen9li-helloworld (v0.1.0)
[fli@puppet ~]$ ll /etc/puppetlabs/code/environments/production/modules/
total 16
drwxr-xr-x. 13 root root 4096 Oct  5 22:06 apache
drwxr-xr-x.  8 root root 4096 Jan 22  2020 concat
drwxr-xr-x.  8 root root  193 Nov 26 00:26 helloworld
drwxr-xr-x.  9 root root 4096 Sep 30 22:56 stdlib
drwxr-xr-x.  5 root root 4096 Mar 24  2020 translate
[fli@puppet ~]$ 
  1. include this module to your site.pp and apply to node1.fen9.li
[fli@puppet ~]$ sudo vim /etc/puppetlabs/code/environments/production/manifests/site.pp 
[fli@puppet ~]$ sudo cat /etc/puppetlabs/code/environments/production/manifests/site.pp 
node 'node1.fen9.li' {
  include apache
  include helloworld
  }
[fli@puppet ~]$ 
  1. check node1.fen9.li after a while
[fli@node1 ~]$ ll /tmp
total 4
-rw-r--r--. 1 root root  8 Nov 26 10:32 foobar.txt
drwx------. 3 root root 17 Nov 26 10:06 systemd-private-0fafa47eadce4d9a9515a534a43b80d7-chronyd.service-fD3Jis
drwx------. 3 root root 17 Nov 26 10:06 systemd-private-0fafa47eadce4d9a9515a534a43b80d7-httpd.service-0jxc6y
[fli@node1 ~]$ cat /tmp/foobar.txt 
foo bar.[fli@node1 ~]$ 
[fli@node1 ~]$ 

Note 3: if you dont want to wait the change to happen automatically, you can logon to managed node and run command to update the node manually.

[fli@node1 ~]$ sudo rm /tmp/foobar.txt 
[fli@node1 ~]$ sudo puppet agent --test
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for node1.fen9.li
Info: Applying configuration version '1606349263'
Notice: /Stage[main]/Helloworld/File[/tmp/foobar.txt]/ensure: defined content as '{sha256}f87d0fa7cef6c21733ff03da3467d4e6b08624188bf5b6c647356c9796010570' (corrective)
Notice: Applied catalog in 1.16 seconds
[fli@node1 ~]$ ll /tmp
total 4
-rw-r--r--. 1 root root  8 Nov 26 11:07 foobar.txt
drwx------. 3 root root 17 Nov 26 11:02 systemd-private-0fafa47eadce4d9a9515a534a43b80d7-chronyd.service-RD8YPv
drwx------. 3 root root 17 Nov 26 10:06 systemd-private-0fafa47eadce4d9a9515a534a43b80d7-httpd.service-0jxc6y
[fli@node1 ~]$ sudo cat /tmp/foobar.txt 
foo bar.[fli@node1 ~]$ 

Limitations

None at the time of writing.

Development

None at the time of writing.

Release Notes/Contributors/Etc. Optional

None at the time of writing.