Skip to content

diodonfrost/ansible-role-packer

Repository files navigation

ansible-role-packer

molecule Ansible Galaxy

This role provide a compliance for install packer on your target host.

Requirements

This role was developed using Ansible 2.8 Backwards compatibility is not guaranteed. Use ansible-galaxy install diodonfrost.packer to install the role on your system.

Role Variables

This role has multiple variables. The defaults for all these variables are the following:

---
# defaults file for ansible-role-packer

# Define Packer version to install
# Possible values: https://releases.hashicorp.com/packer/index.json
# Default: latest
packer_version: latest

# Define urlwhere to download packer package
# Default: use local system path defined in Ansible vars/*.yml
packer_pkg_url: "{{ __packer_pkg_url }}"

# Define where to install Packer binary
# Default: use local system path defined in Ansible vars/*.yml
packer_path: "{{ __packer_path }}"

Dependencies

None

Example Playbook

This is a sample playbook file for deploying the Ansible Galaxy packer role in a localhost and installing the latest version of packer.

---
- hosts: localhost
  become: true
  roles:
    - role: diodonfrost.packer

This role can also install a specific version of packer.

---
- hosts: localhost
  become: true
  roles:
    - role: ansible-role-packer
      vars:
        packer_version: 1.2.5

Local Testing

This project uses Molecule to aid in the development and testing.

To develop or test you'll need to have installed the following:

Testing with Docker

# Install requirements
pip install -r requirements-dev.txt

# Test ansible role with centos 8
molecule test

# Test ansible role with ubuntu 20.04
image=ansible-ubuntu:20.04 molecule test

# Test ansible role with alpine latest
image=ansible-alpine:latest molecule test

# Create centos 7 instance
image=ansible-centos:7 molecule create

# Apply role on centos 7 instance
image=ansible-centos:7 molecule converge

# Launch tests on centos 7 instance
image=ansible-centos:7 molecule verify

Testing with Vagrant and Libvirt

# Test ansible role with FreeBSD
molecule test -s freebsd

# Test ansible role with OpenBSD
molecule test -s openbsd

# Test ansible role with Windows
molecule test -s windows

License

Apache 2

Author Information

This role was created in 2019 by diodonfrost.

About

Ansible role for install the latest version of Packer

Resources

License

Stars

Watchers

Forks

Packages

No packages published