README.md 2.19 KB
Newer Older
1
2
3
packme
======

eric pellegrini's avatar
eric pellegrini committed
4
### overview
5
6
7

`packme` is a python3 application for generating and running `packer` templates.

eric pellegrini's avatar
eric pellegrini committed
8
It works by generating *manifest.json* files out of *manifest.yml* files which contain the packer settings for the image to build. The *manifest.yml* files will be searched in a directory which contains as subdirectories the images to be built using `packer`. That directory has to be defined from the CLI (`-t/--templates-dir` option) and has the following structure:
9
10

```shell
eric pellegrini's avatar
eric pellegrini committed
11
12
13
14
15
16
my_templates_directory/
    image1/
        manifest.yml
    ...
    imageN/
        manifest.yml
17
18
19
20
21
```
 
Each manifest.yml has the following structure:

```shell
eric pellegrini's avatar
eric pellegrini committed
22
23
24
25
26
27
28
29
30
31
32
33
---
parameters:
    param1: value1
    ...
    paramN: valueN

packer:
    description: packer description string
    variables: packer variables dict
    builders: packer builders list
    provisioners: packer provisioners list
    post-processors: packer post processors list
34
35
36
37
38
39
40
```

The packer section is strictly the YAML representation of a packer json file with the standards description, variables, builders, provisioners and post-processors packer fields. Those fields can contain Jinja2 templates which can be of two flavors: `parameters` or `environment`. `parameters` will be defined in the `parameters` section of the YAML file while `environment` will be either environment variables or variables passed through the `packme` CLI.

In order to run `packme`, an input configuration file has to be provided. This file is a YAML file which declares the list of the images for which *manifest.json* file will be built and run after with packer. It has the following structure:

```shell
eric pellegrini's avatar
eric pellegrini committed
41
42
43
44
45
46
47
---
templates:
    image1:
        packages: [package1, ..., packageN]
    ...
    imageN:
        extends: image1
48
49
50
51
52
53
```

where `packages` defines non standard packages that will added as extra provisioners when generating the *manifest.json* file for the corresponding image.

An image can extend another one by starting its building from another image. This is the aim of `extends` keyword which allows to declare that dependency.

eric pellegrini's avatar
eric pellegrini committed
54
### Documentation
55

eric pellegrini's avatar
eric pellegrini committed
56
[packme documentation](https://packme.readthedocs.io/en/latest/)
57

eric pellegrini's avatar
eric pellegrini committed
58
### Prerequesites
59
60
61
62

- packer
- QEMU

eric pellegrini's avatar
eric pellegrini committed
63
### Installation
64

eric pellegrini's avatar
eric pellegrini committed
65
```shell
eric pellegrini's avatar
eric pellegrini committed
66
pip install packme
eric pellegrini's avatar
eric pellegrini committed
67
```