This Dockerfile builds an Archlinux based container, capable of using systemd
, mainly for Ansible role testing.
-
Install Docker.
-
Clone the repository:
git clone https://github.com/chzerv/archlinux-systemd-ansible.git
-
cd
into the directory and rundocker build -t archlinux-systemd-ansible .
docker
can be substituted for any other container engine, e.g., Podman.
-
Install Docker.
-
Pull this image from Docker hub:
docker pull chzerv/archlinux-systemd-ansible:latest
If you built the image locally, you can use that instead.
Now, you can either run commands directly inside the container:
docker run -d --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro archlinux-systemd-ansible:latest ansible --version
Or, you can use it with molecule:
# molecule/default/molecule.yml
---
dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: instance
image: "chzerv/${IMAGE:-archlinux}-systemd-ansible:latest"
command: ${DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
playbooks:
converge: "${MOLECULE_PLAYBOOK:-converge.yml}"
verifier:
name: ansible
This image is used for testing Ansible roles and playbooks locally and/or in CI, hence, security is not a concern. It is not intended or recommended to use this image in production environments.