aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-11-20 00:54:46 +0100
committerEgor Tensin <Egor.Tensin@gmail.com>2023-11-20 01:11:33 +0100
commitb263176e9535ef0e95dab46c4c5f40967bb2a542 (patch)
treec3f60832f320eec55d66d1504f7383879804c062
parentv0.0.27 (diff)
downloadinfra-ansible-b263176e9535ef0e95dab46c4c5f40967bb2a542.tar.gz
infra-ansible-b263176e9535ef0e95dab46c4c5f40967bb2a542.zip
docker: add Arch-specific package names
-rw-r--r--roles/docker/tasks/main.yml24
-rw-r--r--roles/docker/vars/Archlinux.yml5
-rw-r--r--roles/docker/vars/main.yml7
3 files changed, 32 insertions, 4 deletions
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index 95f8565..a5327e0 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -1,3 +1,15 @@
+- name: Ensure ansible_facts used by role
+ ansible.builtin.setup:
+ gather_subset: os_family
+
+- name: Set platform-specific variables
+ ansible.builtin.include_vars: "{{ __docker_vars_file }}"
+ loop:
+ - "{{ ansible_facts['os_family'] }}.yml"
+ vars:
+ __docker_vars_file: "{{ role_path }}/vars/{{ item }}"
+ when: __docker_vars_file is file
+
- name: Configure Docker logging driver
when: docker_logging_driver is defined and docker_logging_driver
ansible.builtin.include_tasks: logging.yml
@@ -5,18 +17,22 @@
- name: Install Docker
become: true
ansible.builtin.package:
- name:
- - docker.io
- - docker-compose
+ name: "{{ docker_package_names }}"
state: present
- name: Enable & start Docker service
become: true
ansible.builtin.systemd_service:
- name: docker
+ name: "{{ docker_service_name }}"
enabled: true
state: started
+- name: Install module dependencies
+ become: true
+ ansible.builtin.package:
+ name: "{{ docker_prune_module_deps }}"
+ state: present
+
- name: Clean up Docker data
become: true
community.docker.docker_prune:
diff --git a/roles/docker/vars/Archlinux.yml b/roles/docker/vars/Archlinux.yml
new file mode 100644
index 0000000..5dfa354
--- /dev/null
+++ b/roles/docker/vars/Archlinux.yml
@@ -0,0 +1,5 @@
+docker_package_names:
+ - docker
+ - docker-compose
+docker_prune_module_deps:
+ - python-requests
diff --git a/roles/docker/vars/main.yml b/roles/docker/vars/main.yml
new file mode 100644
index 0000000..1a8db5f
--- /dev/null
+++ b/roles/docker/vars/main.yml
@@ -0,0 +1,7 @@
+# Ubuntu/Debian:
+docker_package_names:
+ - docker.io
+ - docker-compose
+docker_service_name: docker
+docker_prune_module_deps:
+ - python3-requests