Skip to content

Instantly share code, notes, and snippets.

@glendmaatita
Created July 10, 2024 07:03
Show Gist options
  • Save glendmaatita/38c08ad9a885cfb7edee35bf5e49c38d to your computer and use it in GitHub Desktop.
Save glendmaatita/38c08ad9a885cfb7edee35bf5e49c38d to your computer and use it in GitHub Desktop.
Vagrant Ansible
---
- name: Install Docker on Ubuntu
hosts: all
become: yes
tasks:
- name: Update apt package index
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 3600 # Cache valid for 1 hour to avoid repeated updates
- name: Install packages to allow apt to use a repository over HTTPS
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
state: present
- name: Add Docker’s official GPG key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Set up the stable repository
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
state: present
- name: Install Docker Engine
ansible.builtin.apt:
name: docker-ce
state: present
update_cache: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment