ansible-role-docker/tasks/deb_pkgs.yml

35 lines
1.1 KiB
YAML

---
- 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
- name: Remove the obsolete docker repository
apt_repository: repo='{{ docker_deb_repo_old }}' state=absent update_cache=yes
- name: Add the Docker repository
apt_repository: repo='{{ docker_deb_repo }}' update_cache=yes
- name: Install Docker
apt: pkg={{ docker_deb_packages }} state={{ docker_pkg_status }} update_cache=yes cache_valid_time=3600
when: docker_install | bool
tags: docker
- block:
- name: Ensure that the service is stopped and disabled
service: name=docker state=stopped enabled=no
ignore_errors: True
- name: Remove the Docker package
apt: pkg={{ docker_deb_packages }} state=absent
- name: Remove the Docker repository key
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