Skip to content

plasmops/docker-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go to Docker Hub

Ansible alpine based container image

This container image wraps ansible on alpine, zsh, oh-my-zsh and bundles useful tools and CLI utilities. It can be used in two modes non-interactive and interactive.

IMPORTANT NOTICE: don't use this container on production to avoid security problems it uses fixuid.

Non-Interective mode

In this case you can use the container image directly from docker hub, you will start a privileged container. This is useful for one-off commands, for example:

docker run -it --rm -v $(pwd):/code -w /code plasmops/ansible ansible-playbook myplay.yml

Interactive mode

Used to provide you with and Ansible development sandbox. With everything ready-to-go. It's recommended that first you create a dedicated home volume to be able safely upgrade/reinstall container.

Creating the toolbox container

# create volume first
docker volume create example-ansible-home

# initiate a container
docker run --name example-ansible \
   -u $(id -u):$(id -g) \
   -v example-ansible-home:/home/fixuid \
   -v $(pwd):/code -w /code plasmops/ansible

Using the toolbox container

First we need to initiate a container, you need to change directory of your ansible project (here example project).

# change to a project directory
cd /path/to/example/project

# starting and attaching to an existing project container
docker start example-ansible && docker attach example-ansible

# exec-ing into the sanbox container
docker exec -ti --env COLUMNS=`tput cols` --env LINES=`tput lines` example-ansible zsh

Note that passing the given environment settings fixes the terminal size and colors inside the container, it's advised that you create a special shell profile alias for this like:

alias deti="docker exec -ti --env COLUMNS=`tput cols` --env LINES=`tput lines`"

User environment, zsh theme and plugins

It's also possible to configure zsh on-build refer to the section and supply the following arguments as bellow:

  --build-arg ZSH_PLUGINS="git pyenv" \
  --build-arg ZSH_THEME="cloud" \

By default cloud theme and git plugin are used by providing the above options you can change this behavior.

License and Authors

Author:: Denis Baryshev ([email protected])

About

Ansible alpine based container image

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published