Skip to content

Commit effbe09

Browse files
committed
update readme
Signed-off-by: Tomas Tomecek <[email protected]>
1 parent 0e994d3 commit effbe09

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

README.md

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ plugins](https://docs.ansible.com/ansible/2.6/plugins/connection.html) for perfo
1010

1111
tl;dr Ansible is the frontend, buildah is the backend.
1212

13-
I described this concept a while ago in [this blog post](https://blog.tomecek.net/post/building-containers-with-buildah-and-ansible/).
13+
I described this concept in these blog posts:
14+
* [Building containers with buildah and ansible](https://blog.tomecek.net/post/building-containers-with-buildah-and-ansible/).
15+
* [Ansible and Podman Can Play Together Now](https://blog.tomecek.net/post/ansible-and-podman-can-play-together-now/)
1416

1517
You may be asking: why not
16-
[ansible-container](https://github.com/ansible/ansible-container)? This tool is
18+
[ansible-container](https://github.com/ansible/ansible-container)? Ansible bender is
1719
actually heavily inspired by ansible-container: the main distinction is that
1820
ansible-container covers the complete lifecycle of a containerized application
1921
while ab takes care of image builds only.
2022

2123
**Please note that this project is not affiliated with the Ansible project.
22-
It's just using Ansible to do something magical.**
24+
Even though I work for Red Hat, I am not on the Ansible team. I wrote the tool
25+
because I care about the problem it solves.**
2326

2427

2528
**Status**: proof of concept
@@ -42,33 +45,39 @@ It's just using Ansible to do something magical.**
4245
* You can turn this off with `--no-cache`.
4346
* You can disable caching from a certain point by adding a tag `no-cache` to a task.
4447
* You can stop creating new image layers by adding tag `stop-layering` to a task.
48+
* If an image build fails, it's comitted and named with a suffix `-failed` (so
49+
you can take a look inside and resolve the issue).
4550

4651

47-
## Subcommands
52+
## Interface
4853

49-
* `build` — build a new container image using selected playbook
50-
* `list-builds` — list all builds
51-
* `get-logs` — display build logs
52-
* `inspect` — provide detailed metadata about the selected build
54+
ab has these commands:
5355

56+
Command | Description
57+
--------|------------
58+
`build` | build a new container image using selected playbook
59+
`list-builds` | list all builds
60+
`get-logs` | display build logs
61+
`inspect` | provide detailed metadata about the selected build
5462

55-
## Installation
5663

57-
`ansible-bender` will be on PyPI starting from version `0.2.0`.
64+
## Installation
5865

59-
In the meantime, please install it from github directly:
6066
```
61-
$ pip3 install --user git+https://github.com/TomasTomecek/[email protected]
67+
$ pip3 install ansible-bender
6268
```
6369

64-
Oh right, and ab is tested only with python 3.
70+
Ansible bender supports python 3 only. This means that you need to have a
71+
python3 interpretter inside your base image.
6572

6673

6774
## Usage
6875

6976
You may noticed that I refer to `ansible-bender` as ab. That was the initial
7077
name and also the name of the CLI tool, so I decided to stick to it.
7178

79+
### Building images
80+
7281
If you clone this repository, you can utilize a simple playbook I am using for testing:
7382
```
7483
$ ab build -e SOME=VALUE -l some=other-value -- ./tests/data/basic_playbook.yaml docker.io/library/python:3-alpine this-is-my-image
@@ -139,9 +148,6 @@ $ ab build \ # this is the command
139148
this-is-my-image \ # and finally, target image name
140149
```
141150

142-
At some point, I should figure out a file-format where these would live (ansible variables? a dedicated file?).
143-
144-
145151
If we rerun the build again, we can see that ab loads every task from a cache:
146152
```
147153
$ ab build -e SOME=VALUE -l some=other-value -- ./tests/data/basic_playbook.yaml docker.io/library/python:3-alpine this-is-my-image
@@ -188,6 +194,9 @@ Storing signatures
188194
Image 'this-is-my-image' was built successfully \o/
189195
```
190196

197+
198+
### Listing builds
199+
191200
We can list builds we have done:
192201
```
193202
BUILD ID IMAGE NAME STATUS DATE BUILD TIME
@@ -196,6 +205,9 @@ We can list builds we have done:
196205
2 this-is-my-image BuildState.DONE 2018-10-31 12:19:27.341574 0:00:10.252394
197206
```
198207

208+
209+
### Getting logs of a build
210+
199211
Wanna check build logs sometime later? No problem!
200212
```
201213
$ ab get-logs 2
@@ -225,6 +237,9 @@ PLAY RECAP *********************************************************************
225237
this-is-my-image-20181031-121917088731-cont : ok=1 changed=0 unreachable=0 failed=0
226238
```
227239

240+
241+
### Locating built images with podman
242+
228243
Here is a proof that the image is in there:
229244
```
230245
$ podman images

0 commit comments

Comments
 (0)