From b263176e9535ef0e95dab46c4c5f40967bb2a542 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 20 Nov 2023 00:54:46 +0100 Subject: docker: add Arch-specific package names --- roles/docker/tasks/main.yml | 24 ++++++++++++++++++++---- roles/docker/vars/Archlinux.yml | 5 +++++ roles/docker/vars/main.yml | 7 +++++++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 roles/docker/vars/Archlinux.yml create mode 100644 roles/docker/vars/main.yml (limited to 'roles/docker') 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 -- cgit v1.2.3