Sign inSign up

chriswayg/docker-archlinux-ansible

By chriswayg

Updated almost 6 years ago

Arch Linux container for Ansible playbook & role testing (autobuilds after base/archlinux updates)

Image
1

835

chriswayg/docker-archlinux-ansible repository overview

Arch Linux (latest) Ansible Test Image

Build Status

Arch Linux (latest) Docker container for Ansible playbook and role testing.

How to Build

This image is built on Docker Hub automatically any time a commit is made or merged to the master branch. But if you need to build the image on your own locally, do the following:

  1. Install Docker.
  2. Clone this repository.
  3. cd into the repository directory.
  4. Run docker build -t local-archlinux-ansible .

How to Use

  1. Install Docker.

  2. Pull this image from Docker Hub:

    • docker pull chriswayg/docker-archlinux-ansible:latest (or use the tag you built earlier, e.g. local-archlinux-ansible).
  3. Run a container from the image: (to test my Ansible roles, I add in a volume mounted from the current working directory).

    • docker run --detach --privileged --name archlinux_ansible_1 --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro --volume=$(pwd):/etc/ansible/roles/role_under_test:rw chriswayg/docker-archlinux-ansible:latest
  4. Use Ansible inside the container:

    • docker exec --tty archlinux_ansible_1 env TERM=xterm ansible --version
    • docker exec --tty archlinux_ansible_1 env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check
    • docker exec --tty archlinux_ansible_1 env TERM=xterm ansible-playbook -vv /etc/ansible/roles/role_under_test/tests/test.yml

Notes

I use Docker to test my Ansible roles and playbooks on multiple OSes using CI tools like Travis. This container allows me to test roles and playbooks using Ansible running locally inside the container.

Important Note: I use this image for testing in an isolated environment — not for production — and the settings and configuration used may not be suitable for a secure and performant production environment. Use on production servers at your own risk!

Authors

Tag summary

Content type

Image

Digest

Size

275.2 MB

Last updated

almost 6 years ago

docker pull chriswayg/docker-archlinux-ansible