Support the installation of a specific version.
This commit is contained in:
parent
32e997f1f7
commit
c033608ec9
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"ansible.python.interpreterPath": "/opt/local/bin/python3.10"
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
docker_install: true
|
||||
docker_specific_package_ver: false
|
||||
docker_pkg_version: "5:24.0.1"
|
||||
# Swarm
|
||||
docker_swarm: false
|
||||
docker_swarm_manager: false
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
galaxy_info:
|
||||
author: Andrea Dell'Amico
|
||||
description: Systems Architect
|
||||
namespace: adellam
|
||||
role_name: docker
|
||||
description: Role that installs Docker from their repository
|
||||
company: ISTI-CNR
|
||||
|
||||
issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning
|
||||
|
||||
license: EUPL 1.2+
|
||||
|
||||
min_ansible_version: 2.8
|
||||
min_ansible_version: "2.9"
|
||||
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
|
@ -16,13 +15,12 @@ galaxy_info:
|
|||
- name: Ubuntu
|
||||
versions:
|
||||
- bionic
|
||||
- name: EL
|
||||
versions:
|
||||
- 7
|
||||
- 8
|
||||
- focal
|
||||
- jammy
|
||||
|
||||
galaxy_tags:
|
||||
- users
|
||||
- docker
|
||||
- containers
|
||||
|
||||
dependencies:
|
||||
- src: git+https://gitea-s2i2s.isti.cnr.it/ISTI-ansible-roles/ansible-role-python3-environment.git
|
||||
|
|
|
@ -1,37 +1,67 @@
|
|||
---
|
||||
- block:
|
||||
- name: Docker.com repository
|
||||
when: docker_install | bool
|
||||
tags: [docker,docker_pkg]
|
||||
block:
|
||||
- name: Add the Docker repository key
|
||||
#apt_key: keyserver={{ docker_repo_keyserver }} id={{ docker_repo_key }} state=present
|
||||
apt_key: url={{ docker_deb_repo_key_url }} state=present
|
||||
ansible.builtin.apt_key:
|
||||
url: "{{ docker_deb_repo_key_url }}"
|
||||
state: present
|
||||
|
||||
- name: Remove the old docker packages, from the old distribution method
|
||||
apt: pkg={{ docker_deb_old_packages }} state=absent
|
||||
ansible.builtin.apt:
|
||||
pkg: "{{ docker_deb_old_packages }}"
|
||||
state: absent
|
||||
|
||||
- name: Remove the obsolete docker repository
|
||||
apt_repository: repo='{{ docker_deb_repo_old }}' state=absent update_cache=yes
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "{{ docker_deb_repo_old }}"
|
||||
state: absent
|
||||
update_cache: true
|
||||
|
||||
- name: Add the Docker repository
|
||||
apt_repository: repo='{{ docker_deb_repo }}' update_cache=yes
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "{{ docker_deb_repo }}"
|
||||
update_cache: true
|
||||
|
||||
- name: Install Docker
|
||||
apt: pkg={{ docker_deb_packages }} state={{ docker_pkg_status }} update_cache=yes cache_valid_time=3600
|
||||
- name: Install the latest Docker package available
|
||||
ansible.builtin.apt:
|
||||
pkg: "{{ docker_deb_packages }}"
|
||||
state: "{{ docker_pkg_status }}"
|
||||
cache_valid_time: 3600
|
||||
when: not docker_specific_package_ver
|
||||
|
||||
when: docker_install | bool
|
||||
tags: docker
|
||||
- name: Install a specific Docker package version
|
||||
ansible.builtin.apt:
|
||||
pkg: "{{ docker_versioned_deb_packages }}"
|
||||
state: "{{ docker_pkg_status }}"
|
||||
cache_valid_time: 3600
|
||||
force: true
|
||||
when: docker_specific_package_ver
|
||||
|
||||
- block:
|
||||
- name: Remove the docker packages and repository
|
||||
when: not docker_install | bool
|
||||
tags: [docker,docker_pkg]
|
||||
block:
|
||||
- name: Ensure that the service is stopped and disabled
|
||||
service: name=docker state=stopped enabled=no
|
||||
ignore_errors: True
|
||||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: stopped
|
||||
enabled: false
|
||||
ignore_errors: true
|
||||
|
||||
- name: Remove the Docker package
|
||||
apt: pkg={{ docker_deb_packages }} state=absent
|
||||
ansible.builtin.apt:
|
||||
pkg: "{{ docker_deb_packages }}"
|
||||
state: absent
|
||||
|
||||
- name: Remove the Docker repository key
|
||||
apt_key: id={{ docker_deb_repo_key }} state=absent
|
||||
ansible.builtin.apt_key:
|
||||
id: "{{ docker_deb_repo_key }}"
|
||||
state: absent
|
||||
|
||||
- name: Remove the Docker repository
|
||||
apt_repository: repo='{{ docker_deb_repo }}' state=absent update_cache=yes
|
||||
|
||||
when: not docker_install | bool
|
||||
tags: docker
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "{{ docker_deb_repo }}"
|
||||
state: absent
|
||||
update_cache: true
|
||||
|
|
|
@ -17,8 +17,15 @@ docker_pkg_status: present
|
|||
docker_deb_packages:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- docker-ce-rootless-extras
|
||||
- containerd.io
|
||||
|
||||
docker_versioned_deb_packages:
|
||||
- "docker-ce={{ docker_pkg_version }}"
|
||||
- "docker-ce-cli{{ docker_pkg_version }}"
|
||||
- "docker-ce-rootless-extras{{ docker_pkg_version }}"
|
||||
- containerd.io
|
||||
|
||||
docker_deb_old_packages:
|
||||
- docker-engine
|
||||
- docker.io
|
||||
|
|
Loading…
Reference in New Issue