mschuchard / mschuchard.general / 1.0.1 / module / packer_fmt Module to manage Packer template and config canonical formatting. | "added in version" 1.0.0 of mschuchard.general" Authors: Matthew Schuchard (@mschuchard)mschuchard.general.packer_fmt (1.0.1) — module
Install with ansible-galaxy collection install mschuchard.general:==1.0.1
collections: - name: mschuchard.general version: 1.0.1
Rewrites all Packer configuration files to a canonical format. Both configuration files (.pkr.hcl) and variable files (.pkrvars.hcl) are updated. JSON files (.json) are not modified. The given content must be in Packer's HCL2 configuration language; JSON is not supported.
# rewrite Packer files in /path/to/packer_dir to canonical format - name: Rewrite packer files in /path/to/packer_dir to canonical format mschuchard.general.packer_fmt: config_dir: /path/to/packer_dir
# verify canonical formatting of Packer files in /path/to/packer_dir - name: Verify canonical formatting of packer files in /path/to/packer_dir mschuchard.general.packer_fmt: config_dir: /path/to/packer_dir check: true
# recursively rewrite Packer files in current directory to canonical format - name: Recursively rewrite packer files in current directory to canonical format mschuchard.general.packer_fmt: recursive: true
check: default: false description: Check if the input is formatted. Exit status will be 0 if all input is properly formatted, and non-zero otherwise. required: false type: bool recursive: default: false description: Also process files in subdirectories. By default only the given directory (or current directory) is processed. required: false type: bool config_dir: default: cwd description: Location of the directory or file containing the Packer template(s) and/or config(s). required: false type: str
command: description: The raw Packer command executed by Ansible. returned: always type: str