Skip to content

Ansible role to install docker-daemon and cli

License

Notifications You must be signed in to change notification settings

borisskert/ansible-docker

 
 

Repository files navigation

ansible-docker

Installs docker-daemon and cli.

Requirements

CPU architecture:

  • x86_64 / amd64
  • armv7l / armhf
  • aarch64 / arm64

Operating systems:

  • Ubuntu:
    • 24.04 (noble)
    • 22.04 (jammy)
    • 20.04 (focal)
  • Debian
    • 12 (bookworm)
    • 11 (bullseye)

Tasks

  • Add repository key from keyserver
  • Add docker repository
  • Install docker-ce package
  • Setup docker daemon options (optional)
  • Setup docker-cleanup systemd service (optional)

Role parameters

Variable Type Mandatory? Default Description
docker_storage_driver text no <empty => aufs> The docker storage driver (consider documentation)
docker_cleanup_enabled text no no => disabled Creates a systemd service to delete all stopped containers and delete unused images
docker_cleanup_on_calendar text no daily Choose when your cleanup timer will be triggered

Usage

Add to requirements.yml:

- name: install-docker
  src: https://github.com/borisskert/ansible-docker.git
  scm: git

Example playbooks

Minimal:

- hosts: test_machine
  become: yes

  roles:
    - role: install-docker

All parameters:

- hosts: test_machine
  become: yes

  roles:
    - role: install-docker
      docker_storage_driver: overlay2
      docker_cleanup_enabled: yes
      docker_cleanup_on_calendar: daily

Testing

Requirements:

Run within docker

molecule test

Run within Vagrant

molecule test --scenario-name vagrant --parallel

I recommend to use pyenv for local testing. Within the Github Actions pipeline I use my own molecule Docker image.

About

Ansible role to install docker-daemon and cli

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jinja 100.0%