Giter VIP home page Giter VIP logo

packer-template's Introduction

packer-template

Ansible role to generate Packer templates using YAML and Jinja2.

Due to limitations of JSON, Packer templates contain a lot of code duplication. Flexibility of YAML and Jinja2, helps to reduce the duplication.

Requirements

No requirements for executing the module.

Testing Requirements

Molecule and docker are required for testing. On Debian/Ubuntu based system you can install using:

sudo pip install molecule

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
sudo apt update
sudo apt install -y docker-ce
sudo pip install docker-py

WSL and Docker

If you are using WSL and Docker on a VM, modify the docker config to have TCP listener enabled:

sudo systemctl edit docker
#[Service]
#ExecStart=
#ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375

On WSL, configure the host settings for Docker client:

DOCKER_HOST=127.0.0.1:2375
export DOCKER_HOST

molecule --base-config molecule/base.yml check

Role Variables

packer_name: Name for the template.

packer_dest: Target directory to create Packer template(s), additional file(s) and folder(s).

packer_os_type: OS family. Currently ony excepted value is windows.

packer_options: A dictionary/hashtable for packer template options.

  • image: (Optional|String) Image type. If provided, the role with read default settings from image configuration.
  • builders: (Optional|Dictionary) Packer builders
  • provisioners: (Optional|List) Packer provisioners
  • variables: (Optional|Dictionary) Packer variables
  • sensitive-variables: (Optional|List) Packer sensitive variables array

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
  roles:
     - { role: username.rolename, x: 42 }

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.