mschuchard / mschuchard.general / 1.0.1 / module / packer_validate Module to manage Packer template and config validation. | "added in version" 1.0.0 of mschuchard.general" Authors: Matthew Schuchard (@mschuchard)mschuchard.general.packer_validate (1.0.1) — module
Install with ansible-galaxy collection install mschuchard.general:==1.0.1
collections: - name: mschuchard.general version: 1.0.1
Checks the template is valid by parsing the template and also checking the configuration with the various builders, provisioners, etc. If it is not valid, the errors will be shown and the module task will exit as a failure.
# validate packer templates and configs in /path/to/packer_dir - name: Validate packer templates and configs in /path/to/packer_dir mschuchard.general.packer_validate: config_dir: /path/to/packer_dir
# validate packer files without warning on undeclared variables, and while evaluating datasources - name: Validate packer files without warning on undeclared variables, and while evaluating datasources mschuchard.general.packer_validate: config_dir: /path/to/packer_dir evaluate_datasources: true warn_undeclared_var: false
# validate only the syntax of the null.this and null.that builds in the packer files - name: Validate only the null.this and null.that builds in the packer files mschuchard.general.packer_validate: config_dir: /path/to/packer_dir only: - null.this - null.that syntax_only: true
# validate the packer files with vars and var files - name: Validate the packer files with vars and var files mschuchard.general.packer_validate: config_dir: /path/to/packer_dir var: - var_name: var_value - var_name_other: var_value_other var_file: - one.pkrvars.hcl - two.pkrvars.hcl
var: default: [] description: Variables for templates. required: false type: list only: default: [] description: Validate only these builds. required: false type: list excepts: default: [] description: Validate all builds other than these. required: false type: list var_file: default: [] description: HCL2 files containing user variables. required: false type: list config_dir: default: cwd description: Location of the directory or file containing the Packer template(s) and/or config(s). required: false type: str syntax_only: default: false description: Only check syntax. Do not verify config of the template. required: false type: bool warn_undeclared_var: default: true description: Warnings for user variable files containing undeclared variables (>= 1.8.5) required: false type: bool evaluate_datasources: default: false description: Evaluate data sources during validation (>= 1.8.5) required: false type: bool
command: description: The raw Packer command executed by Ansible. returned: always type: str