Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Create a Puppet Module to Automate WordPress Installation

A step-by-step design for a Puppet module that installs WordPress repeatably, from PHP and database prerequisites through guarded WP-CLI commands, secret handling, rerun safety, testing, and packaging.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A reliable Puppet module for WordPress should converge a known server state: install the supported PHP, database, and web-server prerequisites; place a pinned WP-CLI binary; download WordPress into a declared document root; render wp-config.php from protected data; create the database; and run wp core install exactly once. The module must also define ownership, ordering, and rerun guards so a second Puppet run repairs drift instead of reinstalling or overwriting the site.

Choose the target state before writing manifests

Write down what the module owns and what it merely expects. A complete implementation can manage the operating-system packages, service account, web server, PHP runtime, database, virtual host, WP-CLI, WordPress files, database, and initial administrator. A composable implementation usually delegates the web server, PHP, database, account, and virtual host to dedicated modules and owns only the WordPress application layer. The second model is easier to reuse, provided its prerequisites are explicit.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Supported baseline

WordPress currently asks hosts to support PHP 8.3 or later, MariaDB 10.11 or later or MySQL 8.0 or later, HTTPS, and Apache or NGINX. Older combinations such as PHP 7.4 or MySQL 5.5.5 may still run some releases, but they are end-of-life choices and should not be the baseline for a new module. WP-CLI itself requires PHP 7.2.24 or later, so a host can satisfy WP-CLI while still failing WordPress’s preferred support level.

Component Module contract Why it matters
PHP 8.3 or newer for the WordPress host Provides the supported application runtime; verify the command-line PHP used by WP-CLI is the same compatible version.
Database MariaDB 10.11+ or MySQL 8.0+ Supplies the tables created by wp core install and the credentials rendered into configuration.
Web server Apache or NGINX with HTTPS Serves the document root and passes PHP requests through the platform’s chosen integration.
Filesystem Declared document root, owner, group, and modes Prevents updates from creating mixed ownership and makes drift repairable.
WP-CLI Pinned Phar and checksum Makes the command sequence reproducible instead of downloading a moving target on every run.

Expose a typed, reviewable parameter contract

Parameters are the public API of the module. Use Puppet’s data types so invalid values fail during catalog compilation rather than halfway through an installation. At minimum, expose:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
  • site_url, site_title, and locale.
  • docroot, owner, and group.
  • PHP and operating-system package versions where your platform supports pinning.
  • Database host, name, user, port, and a sensitive password.
  • Initial administrator username, email address, and a sensitive password.
  • The WordPress version and download policy.
  • The WP-CLI source, expected checksum, and install path.
  • Whether this module creates the database and user or expects another module to provide them.
  • The web-service name used for notifications after configuration changes.

Keep secrets as Sensitive[String] values (or retrieve them from an approved secret backend). Do not place a password in a default parameter, a README example, a Git repository, or an exec command line.

Use Puppet’s normal module layout

Each manifest file should contain one class or defined type. Put static files in files/, generated configuration in templates/, and module metadata at the root. A practical layout is:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wordpress_install/
├── manifests/
│   ├── init.pp
│   ├── params.pp
│   ├── prerequisites.pp
│   ├── wp_cli.pp
│   ├── database.pp
│   ├── config.pp
│   └── install.pp
├── templates/
│   ├── wp-config.php.epp
│   └── vhost.conf.epp
├── files/
├── metadata.json
├── README.md
└── .pmtignore

Use template() or epp() in a file resource for generated files. Keep platform-specific package names and service names in parameters or operating-system conditionals instead of scattering them through every class.

Compose the prerequisite classes

The top-level class should include prerequisites, WP-CLI, database resources, configuration, and the application install in a deliberate order. A composable module can declare dependencies on Forge modules for Apache or NGINX, PHP, an account, an archive extractor, and a database. It should document exactly what those dependencies create.

For example, an application-only module might require that the caller provide:

  • An existing service account and group with access to the document root.
  • PHP and the extensions required by the selected WordPress release and database driver.
  • A reachable MariaDB or MySQL server, database, and user.
  • An Apache or NGINX virtual host terminating HTTPS and pointing at the document root.
  • Network access to the approved WP-CLI and WordPress artifacts, or an internal mirror.

An all-in-one module can create those resources itself, but the ownership boundary must be unambiguous. The existing Forge WordPress module pattern is intentionally narrower: it does not create the system account, install PHP, create the database or user, or configure the Apache/NGINX virtual host. Following that boundary avoids two modules fighting over the same resource.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Install WP-CLI reproducibly

The recommended WP-CLI installation is the Phar build: download it, optionally verify its signature or checksum, mark it executable, and place it on PATH. Pin a known WP-CLI release and checksum in module data. A Puppet run should not silently switch to a new executable because an upstream URL changed.

file { '/usr/local/bin/wp':
  ensure   => file,
  mode     => '0755',
  source   => $wp_cli_source,
  checksum => $wp_cli_checksum,
}

If your platform does not support a remote file source with the required verification, download the Phar to a staging path with a controlled provider, verify it, and then move it into place. Ensure the command uses the intended PHP binary; a web-server PHP version and a command-line PHP version can differ.

Model the four WP-CLI stages

The official workflow has four distinct operations. Keeping them as separate resources makes failures diagnosable and lets Puppet enforce dependencies.

1. Download WordPress

Use an explicit path, locale, and version. Guard the command with a file that only exists after a successful extraction, such as wp-includes/version.php.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
exec { 'wp core download':
  command => "wp core download --path=${docroot} --locale=${locale} --version=${wp_version}",
  creates => "${docroot}/wp-includes/version.php",
  require => [File[$docroot], File['/usr/local/bin/wp']],
  user    => $owner,
}

Pinning wp_version gives repeatable builds. A policy that tracks the latest release improves patch currency but means convergence can change application code without a module release. If you choose latest, test the resulting catalog and application before production rollout.

2. Render wp-config.php

Render the database host, name, user, password, table prefix, and salts from an EPP template. Set a restrictive mode and the same owner and group expected by the web process. The file must be created after the WordPress files are present and before the install command.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
file { "${docroot}/wp-config.php":
  ensure  => file,
  owner   => $owner,
  group   => $group,
  mode    => '0640',
  content => epp('wordpress_install/wp-config.php.epp', {
    'db_name'     => $db_name,
    'db_user'     => $db_user,
    'db_password' => $db_password,
    'db_host'     => $db_host,
  }),
  require => Exec['wp core download'],
}

Do not print the rendered content in reports or debugging output. If the module manages salts, make them stable secret data; regenerating them on every run logs out every user and invalidates existing sessions.

3. Create the database

Use a database resource or a database-management module to create the database, user, and grants. The resource should be idempotent and should run before wp core install. If the database is external, model a relationship to the declared dependency or perform a non-destructive connectivity check; do not make the WordPress module guess credentials.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Run the initial install

wp core install creates the WordPress tables and performs the standard installation using the URL, title, locale, and administrator details. A representative resource is:

exec { 'wp core install':
  command => "wp core install --path=${docroot} --url=${site_url} --title=${site_title} --admin_user=${admin_user} --admin_email=${admin_email} --locale=${locale}",
  creates => "${docroot}/.wordpress-installed",
  require => [File["${docroot}/wp-config.php"], Database[$db_name]],
  notify  => Service[$web_service],
  user    => $owner,
}

The marker must be created only after a successful install. If the command itself does not create it, call a small protected wrapper that runs wp core is-installed and then atomically creates the marker. An alternative is an unless guard that runs wp core is-installed --path=...; this is safer when an administrator may have completed the install outside Puppet.

Make every rerun converge safely

Puppet describes desired state, while several WP-CLI actions are one-time transitions. Bridge that difference deliberately:

  • Use creates for downloads and other commands with a reliable success artifact.
  • Use onlyif or unless for state queries such as wp core is-installed.
  • Require the document root before downloading, WP-CLI before invoking it, the database before installation, and configuration before the install command.
  • Declare directory ownership and permissions as ordinary Puppet resources so drift is repaired on every run.
  • Notify the web service only when a virtual-host or PHP configuration file changes; do not restart it after every application run.
  • Never use an unconditional exec for wp core install; it can overwrite settings or fail because tables already exist.

Consider upgrades separately from first installation. A pinned application version should not change merely because an agent runs. To upgrade intentionally, expose a version parameter and use a guarded command such as wp core update --version=..., with backups and a maintenance procedure outside the initial-install path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Protect administrator and database credentials

Command-line arguments can be visible in process listings, shell history, Puppet reports, and audit logs. Do not append either password to the wp core install command. Pass sensitive values through a protected temporary file, an input mechanism supported by the installed WP-CLI version, or a secret backend. The official WP-CLI examples demonstrate redirecting password input from a file to avoid Bash history; the file must be mode-restricted, owned by the correct account, and removed after use.

Keep database credentials in the generated configuration with restrictive permissions. If a secret changes, Puppet should update the file but must not automatically rerun the one-time installation command. Database rotation is an operational procedure: create the new credential, update configuration, test connectivity, then revoke the old one.

Choose ownership and deployment boundaries

Decision Composable approach All-in-one approach
Web server Delegate Apache or NGINX, PHP-FPM integration, TLS, and vhost policy. Create packages, service, HTTPS configuration, and the vhost in this module.
Database Require a database module or managed endpoint and consume its outputs. Create the database, user, grants, and possibly the database service.
Account Require an existing service account and group. Create them and own all filesystem permissions.
WordPress source Own only the pinned application files and configuration. Also own archive handling, update policy, and backup hooks.
Failure domain Smaller catalogs and clearer reuse; integration must be documented. One entry point, but more platform-specific code and upgrade coupling.

Apache and NGINX are both robust WordPress choices. Select based on operating-system support, existing virtual-host conventions, PHP-FPM integration, logging, and the team’s operational knowledge rather than changing web servers inside the WordPress class.

Install dependencies through the chosen delivery workflow

For a Puppet agent/server control repository, record module versions and dependencies in the repository’s Puppetfile and deploy through its normal environment promotion process. For a small standalone host, puppet module install can install a module and its dependencies from the Forge or another configured repository. Do not mix ad hoc installation with a code-managed workflow: an operator-installed dependency can drift from the version tested in the control repository.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep metadata.json accurate. Declare supported operating systems, Puppet compatibility, and dependency constraints. Put tests, build output, logs, editor files, and local artifacts in .pmtignore or .pdkignore. Remove symlinks before publishing; module builds do not support them and can fail even when the manifest compiles locally.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validate before applying to production

  1. Compile the catalog with representative parameters, including a non-default locale, an external database host, and a path containing no trailing slash.
  2. Run a syntax and lint check, then build the module package to catch metadata, ignored-file, and symlink errors.
  3. Apply to a disposable host and verify the PHP CLI version, WP-CLI checksum, document-root ownership, HTTPS vhost, and database grants.
  4. Run Puppet again. The second run should report no download or initial-install action and should not restart the web service unless a configuration changed.
  5. Delete or alter a managed permission and run Puppet once more to confirm drift repair.
  6. Test a failed database connection and a failed WordPress download in a non-production environment. Confirm that no success marker is left behind after failure and that a later corrected run can continue.
  7. Verify that administrator and database passwords do not appear in process listings, Puppet reports, CI logs, or temporary files after cleanup.

Troubleshoot common failures

“wp: command not found”

The executable is not on the PATH used by the exec provider, or the provider is using a different environment. Use the absolute path, declare the file resource as a requirement, and verify its executable mode and PHP interpreter.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Download repeats on every run

The creates path is wrong, the extraction never writes the expected file, or a later resource removes it. Point the guard at a stable file inside the selected version and inspect the document-root ownership.

Installation says WordPress is already installed

The guard does not reflect the real state. Replace a marker-only check with wp core is-installed, or create the marker after detecting an existing valid installation. Never solve this by forcing table replacement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Database authentication fails

Check host, port, TLS requirements, grants for the exact source address, and the password rendered in wp-config.php. Ensure the database resource completes before the install command and that the CLI PHP process can resolve the database hostname.

The site returns a PHP or permission error

Compare the web process’s PHP version and extensions with the CLI environment, then inspect ownership of the document root, wp-content, and the configuration file. The account running PHP must be able to read the application and write only the directories your update policy allows.

A package build fails

Validate metadata.json, remove symlinks, and expand ignore rules for tests, build directories, logs, and local files. Rebuild the package before publishing it to the Forge or your internal repository.

Production readiness checklist

  • PHP 8.3 or newer, MariaDB 10.11 or newer or MySQL 8.0 or newer, HTTPS, and Apache or NGINX are documented prerequisites.
  • All paths, owners, groups, versions, locales, URLs, and service names are parameters with sensible types.
  • WP-CLI and WordPress artifacts are pinned or obtained from an approved mirror with verification.
  • The database and web-server ownership boundary is explicit.
  • wp-config.php is rendered from sensitive data with restrictive permissions.
  • Download and install commands have guards and explicit relationships.
  • A failed run cannot leave a false success marker.
  • A second run is a no-op for one-time operations and repairs ordinary drift.
  • Service notifications occur only for relevant configuration changes.
  • Metadata, dependencies, ignore files, and package contents pass validation, with no symlinks.

What the finished module should guarantee

Given a host that satisfies the declared prerequisites, the module should produce one known WordPress release at one known path, owned by one known account, connected to one known database, and reachable through the declared HTTPS virtual host. A fresh host should install in dependency order; an interrupted run should resume; and a routine Puppet run should preserve the existing site rather than reinstalling it. That is the practical meaning of repeatable, idempotent WordPress automation with Puppet.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.