Skip to content

Alpine container with Ansible and Mitogen preinstalled

License

Notifications You must be signed in to change notification settings

joxz/alpine-ansible-mitogen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

alpine-ansible-mitogen

Alpine container with Ansible and Mitogen preinstalled

Awesome benchmark for using Ansible with Mitogen

Based on my alpine-ansible-py3 docker image

Build Image

Build from git repository

$ git clone https://github.com/joxz/alpine-ansible-mitogen.git && cd alpine-ansible-mitogen

$ make build

The image will be tagged with the short hash from the latest git commit, e.g. jones2748/alpine-ansible-mitogen:7e4e631

Pull from Docker Hub

$ docker pull jones2748/alpine-ansible-mitogen:latest

Docker Hub images will be tagged as jones2748/alpine-ansible-mitogen:latest and/or with git tags, e.g. jones2748/alpine-ansible-mitogen:v0.2

Run Image

Run a playbook inside the container:

$ docker run -it --rm \
    -v ${PWD}:/ansible \
    jones2748/alpine-ansible-mitogen:latest \
    ansible-playbook -i inventory playbook.yml

Sanity checks

make test executes both tests listed below

Builtin test for ansible --version

$ docker run -it --rm alpine-ansible-mitogen:latest version
ansible 2.7.7
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Jan 24 2019, 16:36:30) [GCC 8.2.0]

Builtin test for ansible -m setup all (localhost)

$ docker run -it --rm alpine-ansible-mitogent:latest setup
localhost | SUCCESS => {
    "ansible_facts": {
        "ansible_all_ipv4_addresses": [],
        "ansible_all_ipv6_addresses": [],
        "ansible_apparmor": {
            "status": "disabled"
        },
        "ansible_architecture": "x86_64",
...

Shell access

Shell access as user ansible

$ docker run -it --rm alpine-ansible-mitogen:latest
/ansible $ whoami
ansible

Shell access as user root

$ docker run -it --rm alpine-ansible-mitogen:latest makemeroot
/ansible # whoami
root

Make

Makefile included for build, run, test, clean,...

$ make
build                          build container
build-no-cache                 build container without cache
clean                          remove images
help                           this help
history                        show docker history for container
inspect                        inspect container properties - pretty: 'make inspect | jq .' requires jq
logs                           show docker logs for container (ONLY possible while container is running)
run                            run container
test                           test container with builtin tests