Skip to main content

ansible-config-validator

image Build Status

A helper script to use with the validate option from ansible template module

The module provides a command line tool to validate configuration templates in cases where the validation depends on more than one file, and there is no clear way to sandboxing the validation process.

So, for example, if you want to validate an NGINX config file that contains a server block configuration you will have to validate the entire configuration tree of NGINX files, therefore what this script does is to replace the original config file with the new one, runs the validation command, and then restores all to the previous state independently of the validation command result.

Install

pip install ansible-config-validator

Usage

usage: ansible-template-validator [-h] [-l SYMLINK]
                                  new_file original_file validation_command

Command to be used as helper with ansible template validate. Replaces
original_file with new_file, and then run validation_command. After this,
returns validation_command return code and original_file is restored.If a
symlink is specified, in case it doesn't exists, it is created pointing to
original_file and then is deleted.

positional arguments:
  new_file              File used to replace original_file
  original_file         Original file that is going to be validated
  validation_command    Command to be executed to validate the config files

optional arguments:
  -h, --help            show this help message and exit
  -l SYMLINK, --create-sym-link SYMLINK
                        Creates an ephemeral symbolic link pointing to
                        original_file, just in case it doesn't exists.

Example

- name: Update nginx {{website_config}} file
  template:
    src: "website.conf"
    dest: "{{website_config}}"
    validate: "ansible-template-validator %s {{website_config}} {{nginx_validation_command|quote}}"
  vars:
    website_config: "/etc/nginx/sites-enabled/website.conf"
    nginx_validation_command: /usr/sbin/nginx -t -q -g 'daemon on; master_process on;

Note: The script must have been previously installed on the target node.

Metadata

Release files for ansible-template-validator 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ansible-template-validator 0.1.4
File Size Uploaded Provenance
ansible_template_validator-0.1.4.tar.gz 5.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ansible-template-validator 0.1.4
File Interpreter ABI Platform
ansible_template_validator-0.1.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.0 kB

Release files / ansible_template_validator-0.1.4.tar.gz

Download URL ansible_template_validator-0.1.4.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
74128a0547be48eacbecb61cc6f851709693b7993a6b0c840f39caa8bf1cc08b
BLAKE2b-256 checksum
How to use checksums
a8ed8526f6c1702885d154ab21a71414307e96c0b88a71e86fa613fde55cd728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.15+

Release files / ansible_template_validator-0.1.4-py2.py3-none-any.whl

Download URL ansible_template_validator-0.1.4-py2.py3-none-any.whl
Size 4.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3bbc69f7aaa4742c653416b11e89969b99789bf96f49ddda56bfb0268927c67f
BLAKE2b-256 checksum
How to use checksums
7ec8220aefb4feb070dbefe647fe96692cf56815c075bac6d4bd6fee14987505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/2.7.15+

Security for ansible-template-validator 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page