Last active
April 8, 2024 19:30
-
-
Save nbigot/b74a908e2f5a3aa2190de191e9ec4505 to your computer and use it in GitHub Desktop.
Ansible playbook AWS - install docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This one works perfect. Thanks a lot!