Manage Nginx with Salt.
Table of Contents
See the full SaltStack Formulas installation and usage instructions.
If you are interested in writing or contributing to formulas, please pay attention to the Writing Formula Section.
If you want to use this formula, please pay attention to the FORMULA
file and/or git tag
,
which contains the currently released version. This formula is versioned according to Semantic Versioning.
See Formula Versioning Section for more details.
If you need (non-default) configuration, please refer to:
- how to configure the formula with map.jinja
- the
pillar.example
file - the Special notes section
An example pillar is provided, please see pillar.example. Note that you do not need to specify everything by pillar. Often, it's much easier and less resource-heavy to use the parameters/<grain>/<value>.yaml
files for non-sensitive settings. The underlying logic is explained in map.jinja.
The following states are found in this formula:
nginx
nginx.package
nginx.package.repo
nginx.certs
nginx.certs.dhparam
nginx.certs.managed
nginx.certs.snakeoil
nginx.config
nginx.config.file
nginx.config.selinux
nginx.snippets
nginx.webroots
nginx.service
nginx.servers
nginx.clean
nginx.package.clean
nginx.package.repo.clean
nginx.certs.clean
nginx.config.clean
nginx.snippets.clean
nginx.webroots.clean
nginx.service.clean
nginx.servers.clean
Meta-state.
This installs the nginx package and possibly repository, manages the nginx configuration file plus snippets, manages webroot dirs, generates DH params if requested (discouraged), starts the associated nginx service and manages server configurations.
Installs the nginx package only. If installation from repo is configured, will also configure the selected repo.
This state will install the configured nginx repository. This works for apt/dnf/yum/zypper-based distributions only by default.
Generates certificates for servers that have certs
set.
Also generates Diffie-Hellman key exchange parameters, if requested.
This is discouraged.
Has a dependency on nginx.config.
Manages the nginx service configuration. Has a dependency on nginx.package.
Manages Nginx snippets. Has a dependency on nginx.package.
Ensures configured webroot directories are present. Has a dependency on nginx.package.
Starts the nginx service (and session key rotation service, if configured) and enables it at boot time. Has a dependency on nginx.config.
Manages server configurations and their state (enabled/disabled). Has a dependency on nginx.service.
Meta-state.
Undoes everything performed in the nginx
meta-state
in reverse order, i.e.
removes managed server configurations,
stops the service,
removes webroots if nginx.lookup.remove_all_data_for_sure
is True,
removes snippets, the configuration file and possibly
generated DH params and then uninstalls the package
and possibly repository.
Removes the nginx package and nginx repositories. Has a dependency on nginx.config.clean.
This state will remove the configured nginx repository. This works for apt/dnf/yum/zypper-based distributions only by default.
Removes generated certificates, private keys and DH parameters. Has a dependency on nginx.service.clean.
Removes the configuration of the nginx service and has a dependency on nginx.service.clean.
Removes all managed snippets.
Removes configured webroot directories if
nginx.lookup.remove_all_data_for_sure
is True.
Has a dependency on nginx.service.clean.
Stops the nginx service (and session key rotation service, if configured) and disables it at boot time.
Removes all managed server configurations.
Commit message formatting is significant!
Please see How to contribute for more details.
pre-commit is configured for this formula, which you may optionally use to ease the steps involved in submitting your changes.
First install the pre-commit
package manager using the appropriate method, then run bin/install-hooks
and
now pre-commit
will run automatically on each git commit
.
$ bin/install-hooks pre-commit installed at .git/hooks/pre-commit pre-commit installed at .git/hooks/commit-msg
There is a script that semi-autodocuments available states: bin/slsdoc
.
If a .sls
file begins with a Jinja comment, it will dump that into the docs. It can be configured differently depending on the formula. See the script source code for details currently.
This means if you feel a state should be documented, make sure to write a comment explaining it.