Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ Available states
----------

Install packer and add it to PATH

``packer.templates``
----------
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
----------
--------------------


Manage templates repositories for Packer
3 changes: 2 additions & 1 deletion packer/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ default:
version: '1.4.2'
path:
extract_to: /opt/packer/VERSION
profile: /etc/profile.d/packer.sh
profile: /etc/profile.d/packer.sh
templates: /srv/packer/templates
#Debian:
#Suse:
#Arch:
Expand Down
28 changes: 28 additions & 0 deletions packer/templates.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{%- from "packer/map.jinja" import packer with context %}

packer_templates_create_directory:
file.directory:
- name: {{ packer.path.templates }}
- makedirs: True

{%- for repo_name, repo in salt['pillar.get']('packer:lookup:templates', {}).items() %}

{%- if repo == None %}
{%- set repo = {} %}
{%- endif %}

{%- set address = repo.get('address') %}
{%- set revision = repo.get('revision', 'master') %}

packer_templates_git_repo_{{ repo_name }}:
git.latest:
- name: {{ address }}
- target: {{ packer.path.templates }}/{{ repo_name }}
- rev: {{ revision }}
- require:
- file: packer_templates_create_directory

{%- endfor %}
6 changes: 6 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ packer:
download:
version: '0.11.0'
hash: "sha256=318ffffa13763eb6f29f28f572656356dc3dbf8d54c01ffddd1c5e2f08593adb"
templates:
ubuntu:
address: https://github.com/boxcutter/ubuntu.git
revision: master
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
revision: master
revision: main

bento:
address: https://github.com/chef/bento.git