This Dockerfile builds an Ubuntu 18.04 (Bionic) based container, capable of using systemd
, mainly for Ansible role testing.
-
Install Docker.
-
Clone the repository:
git clone https://github.com/chzerv/ubuntu1804-systemd-ansible.git
-
cd
into the directory and rundocker build -t ubuntu1804-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/ubuntu1804-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 ubuntu1804-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:-ubuntu1804}-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.