Skip to content

Instantly share code, notes, and snippets.

@prashanth-sams
Created December 8, 2019 22:34
Show Gist options
  • Save prashanth-sams/6a548c8f94a5be5ef0960bf7104fb96d to your computer and use it in GitHub Desktop.
Save prashanth-sams/6a548c8f94a5be5ef0960bf7104fb96d to your computer and use it in GitHub Desktop.
Playbook
pip install ansible
---
- hosts: all
tasks:
- name: Update the apt package index
become: yes
apt:
name: "*"
state: latest
update_cache: yes
force_apt_get: yes
- name: Install packages for apt add repository over HTTPS
become: yes
apt:
name: "{{ packagesdep }}"
force_apt_get: yes
state: latest
update_cache: yes
vars:
packagesdep:
- git
- apt-transport-https
- ca-certificates
- wget
- software-properties-common
- gnupg2
- curl
- name: Add Apt signing key from official docker repo
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
- name: add docker official repository for Debian Stretch
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/debian stretch stable
state: present
- name: Index new repo into the cache
become: yes
apt:
name: "*"
state: latest
update_cache: yes
force_apt_get: yes
- name: actually install docker
apt:
name: "docker-ce"
state: latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment