50 lines
1.1 KiB
YAML
50 lines
1.1 KiB
YAML
|
---
|
||
|
- name: Install docker
|
||
|
hosts: all
|
||
|
become: true
|
||
|
strategy: free
|
||
|
gather_facts: true
|
||
|
become_method: sudo
|
||
|
tasks:
|
||
|
|
||
|
- name: Install required system packages
|
||
|
apt:
|
||
|
pkg:
|
||
|
- apt-transport-https
|
||
|
- ca-certificates
|
||
|
- curl
|
||
|
- software-properties-common
|
||
|
- python3-pip
|
||
|
- virtualenv
|
||
|
- python3-setuptools
|
||
|
state: latest
|
||
|
update_cache: true
|
||
|
|
||
|
- name: Add Docker GPG apt Key
|
||
|
apt_key:
|
||
|
url: https://download.docker.com/linux/ubuntu/gpg
|
||
|
state: present
|
||
|
|
||
|
- name: Add Docker Repository
|
||
|
apt_repository:
|
||
|
repo: deb https://download.docker.com/linux/ubuntu jammy stable
|
||
|
state: present
|
||
|
|
||
|
- name: Update apt and install docker-ce
|
||
|
apt:
|
||
|
pkg:
|
||
|
- docker-ce
|
||
|
- docker-compose-plugin
|
||
|
state: latest
|
||
|
update_cache: true
|
||
|
|
||
|
- name: Install Docker Module for Python
|
||
|
pip:
|
||
|
name: docker
|
||
|
|
||
|
- name: Ensure Docker is enabled and running
|
||
|
ansible.builtin.systemd:
|
||
|
name: docker
|
||
|
state: started
|
||
|
enabled: yes
|