Skip to content

Instantly share code, notes, and snippets.

@nbigot
Last active April 8, 2024 19:30
Show Gist options
  • Save nbigot/b74a908e2f5a3aa2190de191e9ec4505 to your computer and use it in GitHub Desktop.
Save nbigot/b74a908e2f5a3aa2190de191e9ec4505 to your computer and use it in GitHub Desktop.
Ansible playbook AWS - install docker
# Ansible playbook AWS - install docker
---
- name: "AWS - Install docker"
hosts: aws-docker-vms
become: yes
tasks:
- name: Update all packages
yum:
name: '*'
state: latest
update_only: yes
- name: Ensure a list of yum packages are installed
yum:
name: "{{ packages }}"
state: latest
update_cache: yes
vars:
packages:
- python-pip
- yum-utils
- device-mapper-persistent-data
- lvm2
- amazon-linux-extras
- name: Add extras repository
shell: yum-config-manager --enable extras
- name: Install docker-ce (centos) via amazon-linux-extras packages
shell: "amazon-linux-extras install docker=18.06.1 -y"
- name: Enable Docker CE service at startup
service:
name: docker
state: started
enabled: yes
- name: Ensure Python pip packages are installed
pip:
name: "{{ packages }}"
vars:
packages:
- boto
- boto3
- docker-compose
@Nmbr-13
Copy link

Nmbr-13 commented Apr 11, 2021

This is an old configuration that works some years ago,
I've solved the problem by creating a new one (gist) :

"Ansible playbook AWS - install docker (2021)"

https://gist.github.com/nbigot/3f066b1bb1aef2334788bbbe1b431bfd

This one works perfect. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment