Skip to content

Ubuntu 20.04 (Focal) container capable to use systemd, for Ansible role and playbook testing.

License

Notifications You must be signed in to change notification settings

chzerv/ubuntu2004-systemd-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ubuntu 20.04 (Focal) Container Image for Ansible Testing

This Dockerfile builds an Ubuntu 20.04 (Focal) based container, capable of using systemd, mainly for Ansible role testing.

How to build locally

  1. Install Docker.

  2. Clone the repository:

    git clone https://github.com/chzerv/ubuntu2004-systemd-ansible.git
  3. cd into the directory and run docker build -t ubuntu2004-systemd-ansible .

docker can be substituted for any other container engine, e.g., Podman.

How to use

  1. Install Docker.

  2. Pull this image from Docker hub:

    docker pull chzerv/ubuntu2004-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 ubuntu2004-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:-ubuntu2004}-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

Notes

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.

About

Ubuntu 20.04 (Focal) container capable to use systemd, for Ansible role and playbook testing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published