Skip to content

A Puppet module to install, configure and deploy the latest Nginx webserver from stable or mainline.

License

Notifications You must be signed in to change notification settings

rehanone/puppet-nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rehan-nginx

Puppet Forge Build Status

Table of Contents

  1. Overview
  2. Module Description
  3. Setup
  4. Usage
  5. Dependencies
  6. Development

Overview

A Puppet module to install, configure and deploy the latest Nginx webserver from stable or mainline (development) branch.

Module Description

A puppet module for managing the installation and configuration of Nginx. This module installs and configures the nginx package and allows configuration of vhosts and the webproxy itself. The main objective of this module is to minimize changes to the default install of nginx package. It tries to give you maximum flexibility by providing vhost resource that can be used to provide a complete file.

Where possible, this module can be used to ensure the nginx installation is up to date with latest upstream release branches of nginx. Currently, this feature is supported for the following OSes:

Setup

In order to install rehan-nginx, run the following command:

$ puppet module install rehan-nginx

The module does expect all the data to be provided through 'Hiera'. See Usage for examples on how to configure it.

Requirements

This module is designed to be as clean and compliant with latest puppet code guidelines.

Usage

Classes

nginx

A basic install with the defaults would be:

contain nginx

Or the PKI Server using the parameters:

class{ 'nginx':
  repo_manage          => true,
  repo_branch          => 'stable',
  package_ensure       => 'latest',
  package_name         => 'nginx',
  package_extras       => [],
  service_manage       => true,
  service_enable       => true,
  service_ensure       => 'running',
  service_name         => 'nginx',
  install_location     => '/etc/nginx',
  firewall_manage      => false,
  enabled_sites_manage => false,
  configs              => hiera_hash('nginx::configs', {}),
  vhosts               => hiera_hash('nginx::vhosts', {}),
}
Parameters
  • repo_manage: Manage the upstream repository on supported OSes. The default value is true.
  • repo_branch: The upstream repo branch can be stable or mainline. The default value is stable.
  • package_ensure: Ensure the nginx package is installed. The default value is latest.
  • package_name: Nginx package name. The default is nginx.
  • package_extras: Any extra packages required along with nginx. The default is an empty array.
  • service_enable: Enables the nginx service at boot. The default is true.
  • service_ensure: Controls the nginx service. The default is running.
  • service_manage: Controls if this module should manage the nginx service. The default is true.
  • service_name: Nginx service name. The default is nginx.
  • install_location: The install location for nginx. The default is /etc/nginx.
  • firewall_manage: Manage the firewall for port 80 and 443 if puppetlabs-firewall module is used. The default is false.
  • enabled_sites_manage: If set to true, the /etc/nginx/sites-enabled will be purged and only managed vhosts will be maintained.
  • configs: The hash value for config files that will be dropped in /etc/nginx/conf.d. See nginx::resource::config for details.
  • vhosts: The hash value for virtual hosts files to be dropped in /etc/nginx/sites-available. See nginx::resource::vhost for details.

All of this data can be provided through Hiera.

YAML

nginx::repo_manage: true
nginx::repo_branch: 'stable'
nginx::package_ensure: 'latest'
nginx::package_name: 'nginx'
nginx::service_manage: true
nginx::service_enable: true
nginx::service_ensure: 'running'
nginx::service_name: 'nginx'
nginx::install_location: '/etc/nginx'
nginx::firewall_manage: false
nginx::enabled_sites_manage: false
nginx::configs:
  logstash_format:
    source: 'puppet:///modules/webproxy/logstash_format.conf'
nginx::vhosts:
  'example.com':
    enabled: true
    source: 'puppet:///modules/webproxy/example.com'

Note: The above config assumes that you have a module called webproxy with a files directoy containing the static files.

Resources

nginx::resource::config

This resource allows creation of a configuration file under /etc/nginx/conf.d.

Usage:

nginx::resource::config { 'logstash_format':
  source => 'puppet:///modules/webproxy/logstash_format.conf',
}
Parameters
  • source a file in a puppet module.

nginx::resource::vhost

This resource allows creation of a virtual host file under /etc/nginx/sites-available.

Usage:

nginx::resource::vhost { 'example.com':
  enabled => true,
  source  => 'puppet:///modules/webproxy/example.com',
}

or with a template:

nginx::resource::vhost { 'example.com':
  enabled => true,
  content => template('webproxy/example.erb'),
}
Parameters
  • source a file in a puppet module. It is not possible to combine this option with content.
  • content Content of the vhost file. It is not possible to combine this option with source.
  • enabled Creates a link under /etc/nginx/sites-enabled.

Dependencies

Development

You can submit pull requests and create issues through the official page of this module on GitHub. Please do report any bug and suggest new features/improvements.

About

A Puppet module to install, configure and deploy the latest Nginx webserver from stable or mainline.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages