mirror of
https://github.com/geerlingguy/ansible-role-docker.git
synced 2025-08-11 13:46:32 +02:00
Merge branch 'master' into docker-nightly
This commit is contained in:
commit
a58c123d95
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -43,11 +43,11 @@ jobs:
|
||||
distro:
|
||||
- rockylinux8
|
||||
- centos7
|
||||
- ubuntu2204
|
||||
- ubuntu2004
|
||||
- ubuntu1804
|
||||
- debian11
|
||||
- debian10
|
||||
- debian9
|
||||
- fedora34
|
||||
|
||||
steps:
|
||||
|
21
README.md
21
README.md
@ -14,18 +14,31 @@ Available variables are listed below, along with default values (see `defaults/m
|
||||
|
||||
# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).
|
||||
docker_edition: 'ce'
|
||||
docker_package: "docker-{{ docker_edition }}"
|
||||
docker_package_state: present
|
||||
docker_packages:
|
||||
- "docker-{{ docker_edition }}"
|
||||
- "docker-{{ docker_edition }}-cli"
|
||||
- "docker-{{ docker_edition }}-rootless-extras"
|
||||
docker_packages_state: present
|
||||
|
||||
The `docker_edition` should be either `ce` (Community Edition) or `ee` (Enterprise Edition). You can also specify a specific version of Docker to install using the distribution-specific format: Red Hat/CentOS: `docker-{{ docker_edition }}-<VERSION>`; Debian/Ubuntu: `docker-{{ docker_edition }}=<VERSION>`.
|
||||
The `docker_edition` should be either `ce` (Community Edition) or `ee` (Enterprise Edition).
|
||||
You can also specify a specific version of Docker to install using the distribution-specific format:
|
||||
Red Hat/CentOS: `docker-{{ docker_edition }}-<VERSION>` (Note: you have to add this to all packages);
|
||||
Debian/Ubuntu: `docker-{{ docker_edition }}=<VERSION>` (Note: you have to add this to all packages).
|
||||
|
||||
You can control whether the package is installed, uninstalled, or at the latest version by setting `docker_package_state` to `present`, `absent`, or `latest`, respectively. Note that the Docker daemon will be automatically restarted if the Docker package is updated. This is a side effect of flushing all handlers (running any of the handlers that have been notified by this and any other role up to this point in the play).
|
||||
|
||||
docker_service_manage: true
|
||||
docker_service_state: started
|
||||
docker_service_enabled: true
|
||||
docker_restart_handler_state: restarted
|
||||
|
||||
Variables to control the state of the `docker` service, and whether it should start on boot. If you're installing Docker inside a Docker container without systemd or sysvinit, you should set these to `stopped` and set the enabled variable to `no`.
|
||||
Variables to control the state of the `docker` service, and whether it should start on boot. If you're installing Docker inside a Docker container without systemd or sysvinit, you should set `docker_service_manage` to `false`.
|
||||
|
||||
docker_install_compose_plugin: false
|
||||
docker_compose_package: docker-compose-plugin
|
||||
docker_compose_package_state: present
|
||||
|
||||
Docker Compose Plugin installation options. These differ from the below in that docker-compose is installed as a docker plugin (and used with `docker compose`) instead of a standalone binary.
|
||||
|
||||
docker_install_compose: true
|
||||
docker_compose_version: "1.26.0"
|
||||
|
@ -1,15 +1,24 @@
|
||||
---
|
||||
# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition).
|
||||
docker_edition: 'ce'
|
||||
#docker_package: "docker-{{ docker_edition }}"
|
||||
docker_package: "docker.io"
|
||||
docker_package_state: present
|
||||
docker_packages:
|
||||
- "docker-{{ docker_edition }}"
|
||||
- "docker-{{ docker_edition }}-cli"
|
||||
- "docker-{{ docker_edition }}-rootless-extras"
|
||||
- "containerd.io"
|
||||
docker_packages_state: present
|
||||
|
||||
# Service options.
|
||||
docker_service_manage: true
|
||||
docker_service_state: started
|
||||
docker_service_enabled: true
|
||||
docker_restart_handler_state: restarted
|
||||
|
||||
# Docker Compose Plugin options.
|
||||
docker_install_compose_plugin: false
|
||||
docker_compose_package: docker-compose-plugin
|
||||
docker_compose_package_state: present
|
||||
|
||||
# Docker Compose options.
|
||||
docker_install_compose: true
|
||||
docker_compose_version: "v2.4.1"
|
||||
|
@ -1,4 +1,7 @@
|
||||
---
|
||||
- name: restart docker
|
||||
service: "name=docker state={{ docker_restart_handler_state }}"
|
||||
service:
|
||||
name: docker
|
||||
state: "{{ docker_restart_handler_state }}"
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
when: docker_service_manage | bool
|
||||
|
@ -18,12 +18,10 @@ galaxy_info:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- stretch
|
||||
- buster
|
||||
- bullseye
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- xenial
|
||||
- bionic
|
||||
- focal
|
||||
- jammy
|
||||
|
@ -5,23 +5,40 @@
|
||||
- include_tasks: setup-Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Install Docker.
|
||||
- name: Install Docker packages.
|
||||
package:
|
||||
name: "{{ docker_package }}"
|
||||
state: "{{ docker_package_state }}"
|
||||
name: "{{ docker_packages }}"
|
||||
state: "{{ docker_packages_state }}"
|
||||
notify: restart docker
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
when: "ansible_version.full is version_compare('2.12', '<') or ansible_os_family not in ['RedHat', 'Debian']"
|
||||
|
||||
- name: Install Docker (with downgrade option).
|
||||
- name: Install Docker packages (with downgrade option).
|
||||
package:
|
||||
name: "{{ docker_package }}"
|
||||
state: "{{ docker_package_state }}"
|
||||
name: "{{ docker_packages }}"
|
||||
state: "{{ docker_packages_state }}"
|
||||
allow_downgrade: true
|
||||
notify: restart docker
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
when: "ansible_version.full is version_compare('2.12', '>=') and ansible_os_family in ['RedHat', 'Debian']"
|
||||
|
||||
- name: Install docker-compose plugin.
|
||||
package:
|
||||
name: "{{ docker_compose_package }}"
|
||||
state: "{{ docker_compose_package_state }}"
|
||||
notify: restart docker
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
when: "docker_install_compose_plugin | bool == true and (ansible_version.full is version_compare('2.12', '<') or ansible_os_family not in ['RedHat', 'Debian'])"
|
||||
|
||||
- name: Install docker-compose-plugin (with downgrade option).
|
||||
package:
|
||||
name: "{{ docker_compose_package }}"
|
||||
state: "{{ docker_compose_package_state }}"
|
||||
allow_downgrade: true
|
||||
notify: restart docker
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
when: "docker_install_compose_plugin | bool == true and ansible_version.full is version_compare('2.12', '>=') and ansible_os_family in ['RedHat', 'Debian']"
|
||||
|
||||
- name: Ensure /etc/docker/ directory exists.
|
||||
file:
|
||||
path: /etc/docker
|
||||
@ -43,6 +60,7 @@
|
||||
state: "{{ docker_service_state }}"
|
||||
enabled: "{{ docker_service_enabled }}"
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
when: docker_service_manage | bool
|
||||
|
||||
- name: Ensure handlers are notified now to avoid firewall conflicts.
|
||||
meta: flush_handlers
|
||||
|
Loading…
Reference in New Issue
Block a user