aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/docker
diff options
context:
space:
mode:
Diffstat (limited to 'fdio.infra.ansible/roles/docker')
-rw-r--r--fdio.infra.ansible/roles/docker/defaults/main.yaml7
-rw-r--r--fdio.infra.ansible/roles/docker/handlers/main.yaml2
-rw-r--r--fdio.infra.ansible/roles/docker/meta/main.yaml17
-rw-r--r--fdio.infra.ansible/roles/docker/tasks/focal.yaml (renamed from fdio.infra.ansible/roles/docker/tasks/ubuntu_focal.yaml)6
-rw-r--r--fdio.infra.ansible/roles/docker/tasks/jammy.yaml (renamed from fdio.infra.ansible/roles/docker/tasks/ubuntu_jammy.yaml)6
-rw-r--r--fdio.infra.ansible/roles/docker/tasks/main.yaml39
6 files changed, 45 insertions, 32 deletions
diff --git a/fdio.infra.ansible/roles/docker/defaults/main.yaml b/fdio.infra.ansible/roles/docker/defaults/main.yaml
index a8f4e6289d..e493d1c9b5 100644
--- a/fdio.infra.ansible/roles/docker/defaults/main.yaml
+++ b/fdio.infra.ansible/roles/docker/defaults/main.yaml
@@ -10,10 +10,11 @@ docker_package_state: latest
docker_service_state: started
docker_service_enabled: true
docker_restart_handler_state: restarted
+docker_service_mgr: ""
# Used only for Debian/Ubuntu.
docker_apt_release_channel: "stable"
-docker_apt_repository: "deb https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
+docker_apt_repository: "deb https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
docker_apt_repository_state: present
docker_apt_ignore_key_error: true
docker_apt_gpg_key: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
@@ -25,10 +26,6 @@ docker_yum_repo_enable_edge: "0"
docker_yum_repo_enable_test: "0"
docker_yum_gpg_key: https://download.docker.com/linux/centos/gpg
-# A list of users who will be added to the docker group.
-docker_users:
- - "{{ ansible_user }}"
-
# Proxy settings.
docker_daemon_environment_http:
- "HTTP_PROXY={{ proxy_env.http_proxy }}"
diff --git a/fdio.infra.ansible/roles/docker/handlers/main.yaml b/fdio.infra.ansible/roles/docker/handlers/main.yaml
index 572b789d48..53eb8528f6 100644
--- a/fdio.infra.ansible/roles/docker/handlers/main.yaml
+++ b/fdio.infra.ansible/roles/docker/handlers/main.yaml
@@ -2,7 +2,7 @@
# file roles/docker/handlers/main.yaml
- name: Restart Docker
- service:
+ ansible.builtin.service:
name: "docker"
state: "{{ docker_restart_handler_state }}"
tags:
diff --git a/fdio.infra.ansible/roles/docker/meta/main.yaml b/fdio.infra.ansible/roles/docker/meta/main.yaml
index e191fd43b6..ac6c0a9980 100644
--- a/fdio.infra.ansible/roles/docker/meta/main.yaml
+++ b/fdio.infra.ansible/roles/docker/meta/main.yaml
@@ -1,4 +1,19 @@
---
-# file: roles/docker/meta/main.yaml
+# file: meta/main.yaml
dependencies: []
+
+galaxy_info:
+ role_name: docker
+ author: fd.io
+ description: Docker-CE for Linux.
+ company: none
+ license: "license (Apache)"
+ min_ansible_version: 2.9
+ platforms:
+ - name: Ubuntu
+ versions:
+ - focal
+ - jammy
+ galaxy_tags:
+ - docker
diff --git a/fdio.infra.ansible/roles/docker/tasks/ubuntu_focal.yaml b/fdio.infra.ansible/roles/docker/tasks/focal.yaml
index 236cec6322..27fee6285c 100644
--- a/fdio.infra.ansible/roles/docker/tasks/ubuntu_focal.yaml
+++ b/fdio.infra.ansible/roles/docker/tasks/focal.yaml
@@ -2,7 +2,7 @@
# file: roles/docker/tasks/ubuntu_focal.yaml
- name: Inst - Dependencies
- apt:
+ ansible.builtin.apt:
name:
- "apt-transport-https"
- "ca-certificates"
@@ -15,14 +15,14 @@
- docker-inst-dependencies
- name: Conf - Add APT Key
- apt_key:
+ ansible.builtin.apt_key:
url: "{{ docker_apt_gpg_key }}"
state: "{{ docker_apt_gpg_key_state }}"
tags:
- docker-conf-apt
- name: Conf - Install APT Repository
- apt_repository:
+ ansible.builtin.apt_repository:
repo: "{{ docker_apt_repository }}"
state: "{{ docker_apt_repository_state }}"
update_cache: true
diff --git a/fdio.infra.ansible/roles/docker/tasks/ubuntu_jammy.yaml b/fdio.infra.ansible/roles/docker/tasks/jammy.yaml
index 51f60ee348..8ec7a01ee1 100644
--- a/fdio.infra.ansible/roles/docker/tasks/ubuntu_jammy.yaml
+++ b/fdio.infra.ansible/roles/docker/tasks/jammy.yaml
@@ -2,7 +2,7 @@
# file: roles/docker/tasks/ubuntu_jammy.yaml
- name: Inst - Dependencies
- apt:
+ ansible.builtin.apt:
name:
- "apt-transport-https"
- "ca-certificates"
@@ -15,14 +15,14 @@
- docker-inst-dependencies
- name: Conf - Add APT Key
- apt_key:
+ ansible.builtin.apt_key:
url: "{{ docker_apt_gpg_key }}"
state: "{{ docker_apt_gpg_key_state }}"
tags:
- docker-conf-apt
- name: Conf - Install APT Repository
- apt_repository:
+ ansible.builtin.apt_repository:
repo: "{{ docker_apt_repository }}"
state: "{{ docker_apt_repository_state }}"
update_cache: true
diff --git a/fdio.infra.ansible/roles/docker/tasks/main.yaml b/fdio.infra.ansible/roles/docker/tasks/main.yaml
index 27b9d250da..e07b29e363 100644
--- a/fdio.infra.ansible/roles/docker/tasks/main.yaml
+++ b/fdio.infra.ansible/roles/docker/tasks/main.yaml
@@ -1,12 +1,12 @@
---
# file: roles/docker/tasks/main.yaml
-- include_tasks: "{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml"
+- include_tasks: "{{ ansible_distribution_release }}.yaml"
tags:
- docker-inst-dependencies
- name: Inst - Docker
- package:
+ ansible.builtin.package:
name:
- "{{ docker_package }}"
- "{{ docker_package }}-cli"
@@ -15,22 +15,27 @@
- docker-inst-package
- name: Conf - Docker Service
- service:
+ ansible.builtin.service:
name: docker
state: "{{ docker_service_state }}"
enabled: "{{ docker_service_enabled }}"
+ when:
+ - docker_service_mgr == "systemd"
tags:
- docker-conf-service
- name: Conf - Docker Service Directory
- file:
+ ansible.builtin.file:
path: "/etc/systemd/system/docker.service.d"
state: "directory"
+ mode: "0755"
+ when:
+ - docker_service_mgr == "systemd"
tags:
- docker-conf-service
- name: Conf - Docker Daemon
- template:
+ ansible.builtin.template:
src: "templates/daemon.json.j2"
dest: "/etc/docker/daemon.json"
owner: "root"
@@ -39,12 +44,13 @@
notify:
- "Restart Docker"
when: >
- docker_daemon is defined
+ docker_daemon is defined and
+ docker_service_mgr == "systemd"
tags:
- docker-conf-daemon
- name: Conf - Docker HTTP Proxy
- template:
+ ansible.builtin.template:
src: "templates/docker.service.proxy.http"
dest: "/etc/systemd/system/docker.service.d/http-proxy.conf"
owner: "root"
@@ -54,12 +60,13 @@
- "Restart Docker"
when: >
proxy_env is defined and
- proxy_env.http_proxy is defined
+ proxy_env.http_proxy is defined and
+ docker_service_mgr == "systemd"
tags:
- docker-conf-service
- name: Conf - Docker HTTPS Proxy
- template:
+ ansible.builtin.template:
src: "templates/docker.service.proxy.https"
dest: "/etc/systemd/system/docker.service.d/https-proxy.conf"
owner: "root"
@@ -69,16 +76,10 @@
- "Restart Docker"
when: >
proxy_env is defined and
- proxy_env.https_proxy is defined
+ proxy_env.https_proxy is defined and
+ docker_service_mgr == "systemd"
tags:
- docker-conf-service
-- name: Conf - Users to Docker Group
- user:
- name: "{{ ansible_user }}"
- groups: "docker"
- append: true
- tags:
- - docker-conf-user
-
-- meta: flush_handlers
+- name: Meta - Flush handlers
+ ansible.builtin.meta: flush_handlers