2015-05-28 11:32:57 +02:00
|
|
|
---
|
2016-12-05 19:26:29 +01:00
|
|
|
- block:
|
|
|
|
- name: Add the Docker repository key
|
2016-12-26 12:15:23 +01:00
|
|
|
apt_key: keyserver={{ docker_repo_keyserver }} id={{ docker_repo_key }} state=present
|
2015-05-28 11:32:57 +02:00
|
|
|
|
2016-12-05 19:26:29 +01:00
|
|
|
- name: Add the Docker repository
|
|
|
|
apt_repository: repo='{{ docker_repo }}' update_cache=yes
|
2015-05-28 11:32:57 +02:00
|
|
|
|
2016-12-26 12:15:23 +01:00
|
|
|
- name: Create the docker user
|
|
|
|
user: name=docker comment="Docker User" shell=/bin/bash home={{ docker_user_home }} system=yes
|
|
|
|
when: docker_run_as_docker_user
|
|
|
|
|
2016-12-05 19:26:29 +01:00
|
|
|
- name: Install Docker
|
|
|
|
apt: pkg={{ item }} state={{ docker_pkg_status }} update_cache=yes cache_valid_time=3600
|
|
|
|
with_items: '{{ docker_packages }}'
|
2015-05-28 11:32:57 +02:00
|
|
|
|
2016-12-05 19:26:29 +01:00
|
|
|
- name: Ensure that the service is started and enabled
|
|
|
|
service: name=docker state=started enabled=yes
|
|
|
|
|
|
|
|
when: docker_install
|
|
|
|
tags: docker
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Ensure that the service is stopped and disabled
|
|
|
|
service: name=docker state=stopped enabled=no
|
|
|
|
|
|
|
|
- name: Remove the Docker package
|
|
|
|
apt: pkg={{ item }} state=absent
|
|
|
|
with_items: '{{ docker_packages }}'
|
|
|
|
|
2016-12-26 12:15:23 +01:00
|
|
|
- name: Remove the docker user
|
|
|
|
user: name=docker state=absent
|
|
|
|
|
2016-12-05 19:26:29 +01:00
|
|
|
- name: Remove the Docker repository key
|
2016-12-26 12:15:23 +01:00
|
|
|
apt_key: keyserver={{ docker_repo_keyserver }} id={{ docker_repo_key }} state=absent
|
2016-12-05 19:26:29 +01:00
|
|
|
|
|
|
|
- name: Remove the Docker repository
|
|
|
|
apt_repository: repo='{{ docker_repo }}' state=absent update_cache=yes
|
|
|
|
|
|
|
|
when: not docker_install
|
|
|
|
tags: docker
|