infrastructure/playbooks/roles/software/tasks/docker.yml

49 lines
1.1 KiB
YAML
Raw Normal View History

2024-09-26 22:02:36 +00:00
- name: Install required system packages
ansible.builtin.apt:
2024-09-26 22:02:36 +00:00
pkg:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- python3-pip
- virtualenv
- python3-setuptools
state: present
2024-09-26 22:02:36 +00:00
update_cache: true
become: true
- name: Add Docker GPG apt Key
ansible.builtin.apt_key:
2024-09-26 22:02:36 +00:00
url: https://download.docker.com/linux/ubuntu/gpg
state: present
become: true
- name: Add Docker Repository
ansible.builtin.apt_repository:
2024-09-26 22:02:36 +00:00
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
become: true
- name: Update apt and install docker packages
ansible.builtin.apt:
2024-09-26 22:02:36 +00:00
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
2024-09-26 22:02:36 +00:00
update_cache: true
become: true
- name: Add user to the Docker group
ansible.builtin.user:
2024-09-26 22:02:36 +00:00
name: "{{ ansible_user }}"
groups: docker
append: true
2024-09-26 22:02:36 +00:00
become: true
- name: Create a network
community.docker.docker_network:
name: apps