iac/ansible/roles/docker/tasks/main.yml

46 lines
1 KiB
YAML

---
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
- name: Create /etc/apt/keyrings dir
become: true
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
recurse: true
- name: Add Docker GPG apt Key
become: true
ansible.builtin.apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
- name: Add Docker Repository
become: true
ansible.builtin.apt_repository:
repo: deb https://download.docker.com/linux/debian buster stable
state: present
- name: Update apt and install docker-ce
become: true
ansible.builtin.apt:
name: docker-ce
update_cache: true
#- name: Install Docker Module for Python
# become: true
# community.general.pipx:
# name: docker
- name: Ensure docker group is present
become: true
ansible.builtin.group:
name: docker
state: present
- name: Add user to docker group
become: true
ansible.builtin.user:
name: "{{ ansible_user_id }}"
groups: docker,users,admin