Public | Automated Build

Last pushed: 2 years ago
Short Description
Control CoreOS boxes with ansible using a toolbox image.
Full Description

Docker CoreOS Ansible toolbox

This repo is based on ianbytchek/docker-coreos-ansible-toolbox

<div align="center"><img src="./documentation/asset/docker-coreos-ansible-toolbox.png"></div>

CoreOS is awesome, so is Ansible. However, running Ansible tasks on CoreOS is a pain, mostly due to lack of Python, which is not there for a good reason. CoreOS toolbox is a small script that uses containers to let you bring in your favorite tools into CoreOS.

Attention

This repository was created with hopes of possibility to easily execute ansible commands within toolbox with full access to CoreOS resources. The general idea is great, but fails in practice when you need to do anything outside pure Python, for example, control etcd or fleet, or systemd, or something else that lives on the host. You can provide access to many things by mounting executables and dependencies as volumes, but this starts to feel hacky very quickly and sometimes doesn't work.

My advice is to setup Python on the host if dealing with similar scenarios. Otherwise, using Python within toolbox is a neat way to do stuff, highly recommended.

Running

Toolbox setup and installation is covered in CoreOS documentation, in a nutshell, to make it the default toolbox image you must specify allen13/coreos-ansible-toolbox image in ~/.toolboxrc parameters manually or via cloud-config.

TOOLBOX_DOCKER_IMAGE=allen13/coreos-ansible-toolbox
TOOLBOX_USER=root

Vincent Ambo has a great article on provisioning CoreOS with Ansible. Besides configuring ~/.toolboxrc you'll also need to create /opt/bin/python and /opt/bin/pip and set ansible_python_interpreter inventory variable to /opt/bin/python.

# Use --quiet option to prevent nspawn printing useless messages every time we call `python` and `pip`.

sudo mkdir --parents '/opt/bin'

sudo tee '/opt/bin/python' > /dev/null <<-'EOL'
    #!/bin/bash
    toolbox --quiet --bind=/home:/home python "$@"
EOL

sudo chmod +x '/opt/bin/python'

sudo tee '/opt/bin/pip' > /dev/null <<-'EOL'
    #!/bin/bash
    toolbox --quiet --bind=/home:/home pip "$@"
EOL

sudo chmod +x '/opt/bin/pip'
Docker Pull Command
Owner
allen13
Source Repository

Comments (0)