added auto_update feature

This commit is contained in:
Bertrand Lanson 2023-06-03 22:02:24 +02:00
parent d2cd776732
commit bbe35f8d48
5 changed files with 13 additions and 5 deletions

View File

@ -18,6 +18,11 @@ install_docker_edition: ce # by default, set to ce
```
This variable sets the edition of docker to install. It can be either `ce` (community edition) or `ee` (enterprise edition).
```yaml
install_docker_auto_update: false # by default, set to false
```
This variable allows you to choose to automatically update docker if a newer version is available whenever the role is replayed. Updating docker is usually pretty safe if done on a regular basis.
```yaml
install_docker_start_service: true
```

View File

@ -1,5 +1,6 @@
---
# install_docker_edition: ce # can be ce or ee (community or enterprise)
# install_docker_auto_update: false
# install_docker_start_service: true
# install_docker_compose: false
# install_docker_compose_version: latest

View File

@ -1,6 +1,7 @@
---
# defaults file for install_docker
install_docker_edition: ce # can be ce or ee (community or enterprise)
install_docker_auto_update: false
install_docker_start_service: true
install_docker_compose: false
install_docker_compose_version: latest

View File

@ -1,5 +1,6 @@
---
install_docker_edition: ce # can be ce or ee (community or enterprise)
install_docker_auto_update: true
install_docker_start_service: true
install_docker_compose: true
install_docker_compose_version: latest

View File

@ -12,20 +12,20 @@ install_docker_daemon_dir: /etc/docker
install_docker_packages:
- name: "docker-{{ install_docker_edition }}"
version: latest
state: present
state: "{% if install_docker_auto_update %}latest{% else %}present{% endif %}"
- name: "docker-{{ install_docker_edition }}-cli"
version: latest
state: present
state: "{% if install_docker_auto_update %}latest{% else %}present{% endif %}"
- name: "docker-{{ install_docker_edition }}-rootless-extras"
version: latest
state: present
state: "{% if install_docker_auto_update %}latest{% else %}present{% endif %}"
- name: "containerd.io"
version: latest
state: present
state: "{% if install_docker_auto_update %}latest{% else %}present{% endif %}"
install_docker_pip_packages:
- name: docker
version_constraint: latest
state: present
state: "{% if install_docker_auto_update %}latest{% else %}present{% endif %}"
install_docker_repository:
- uri: "https://download.docker.com/linux/{{ ansible_distribution|lower }}"
gpg_key: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"