Ansible
Ansible - Install Docker and Docker Compose on Ubuntu
vi install_docker.yml
---
- hosts: all
become: yes
tasks:
- name: Install required packages
apt:
name: "{{ item }}"
update_cache: yes
loop:
- apt-transport-https
- ca-certificates
- software-properties-common
- name: Install Docker
shell: curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
- name: Install Docker Compose
shell: curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- name: Docker Composer executable permission
shell: chmod +x /usr/local/bin/docker-compose
- name: Docker Composer symbolic link
shell: ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
ansible-playbook -K install_docker.yml