Public Repository

Last pushed: a year ago
Short Description
Alpine image with Ansible
Full Description

Tags & Dockerfile

What is Ansible?

Ansible is a free-software platform for configuring and managing computers which combines multi-node software deployment, ad hoc task execution, and configuration management.

Description

Alpine Linux image with the following applications installed:

  • Ansible
  • Python
  • pip

Common uses

This image can be used for:

Ansible/Python playground

You can test your playbooks just mounting your playbook directory into the container.

$ docker run -it --rm -v /my-playbooks:/playbooks jfusterm/ansible sh
/ # ansible-playbook /playbooks/main.yml

Base image

Instead of using Dockerfiles to build images, you can provision Docker images using Packer with Ansible. Having for instance a JSON file called docker.json and a playbook called nginx.yml, you can build a Docker image with Nginx on it.

  • docker.json
{
    "builders": [
        {
            "type": "docker",
            "image": "jfusterm/ansible",
            "commit": true
        }
    ],
    "provisioners": [
        {
            "type": "ansible-local",
            "playbook_dir": "/my-playbooks",
            "playbook_file": "nginx.yml"
        }
    ],
    "post-processors": [
        {
            "type": "docker-tag",
            "repository": "my-image",
            "tag": "1.0"
        }
    ]
}
  • nginx.yml
---
- name: Nginx installation
  apk: 
     name=nginx 
     state=present 
     update_cache=yes

Now we can just build our Docker image.

$ packer build docker.json
...
$ docker images
REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
my-image                   1.0                 929fd63420c1        7 seconds ago       71.07 MB
Docker Pull Command
Owner
jfusterm

Comments (0)