Skip to content

Instantly share code, notes, and snippets.

@hkwi
Last active June 7, 2019 13:55
Show Gist options
  • Save hkwi/24ebe0ea8e2287e19df251609780c91c to your computer and use it in GitHub Desktop.
Save hkwi/24ebe0ea8e2287e19df251609780c91c to your computer and use it in GitHub Desktop.
docker-ce install

https://docs.docker.com/install/linux/docker-ce/ubuntu/

ansible-playbook

- hosts: all
  gather_facts: yes
  vars:
    ansible_python_interpreter: /usr/bin/python3
  tasks:
  - apt_key:
      url: https://download.docker.com/linux/ubuntu/gpg
      state: present
  - apt_repository:
      repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable"
      state: present
    when: ansible_lsb is defined
  - apt:
      name:
      - docker-ce
      - docker-ce-cli
      - containerd.io
      update_cache: yes
    when: ansible_lsb is defined

cloud-init

#cloud-config
apt:
  sources:
    docker:
      source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
      keyid: 0EBFCD88
      keyserver: https://download.docker.com/linux/ubuntu/gpg
apt_update: true
packages:
- docker-ce
- docker-ce-cli
- containerd.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment