mschuchard.general.packer_init (1.0.1) — module

Module to manage Packer template and config directory initialization.

| "added in version" 1.0.0 of mschuchard.general"

Authors: Matthew Schuchard (@mschuchard)

Install collection

Install with ansible-galaxy collection install mschuchard.general:==1.0.1


Add to requirements.yml

  collections:
    - name: mschuchard.general
      version: 1.0.1

Description

Install all the missing plugins required in a Packer config. Note that Packer does not have a state. This is the first command that should be executed when working with a new or existing template. This command is always safe to run multiple times. Though subsequent runs may give errors, this command will never delete anything.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# initialize directory in /path/to/packer_config_dir
- name: Initialize packer directory in /path/to/packer_config_dir
  mschuchard.general.packer_init:
    config_dir: /path/to/packer_config_dir
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# initialize current directory and upgrade plugins
- name: Initialize current packer directory and upgrade plugins
  mschuchard.general.packer_init:
    upgrade: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# initialize directory in /path/to/packer_config_dir and upgrade plugins
- name: Initialize packer directory in /path/to/packer_config_dir and upgrade plugins
  mschuchard.general.packer_init:
    config_dir: /path/to/packer_config_dir
    upgrade: true

Inputs

    
upgrade:
    default: false
    description: Update installed plugins to the latest available version if there is
      a new higher one. Note that this still considers the version constraint of the config.
    required: false
    type: bool

config_dir:
    default: cwd
    description: Location of the directory containing the Packer config file.
    required: false
    type: str

Outputs

command:
  description: The raw Packer command executed by Ansible.
  returned: always
  sample: packer init -machine-readable /home/packer
  type: str