Created
January 5, 2021 07:25
-
-
Save mdiener21/70d85671f5a2c26d82ac1f162c3a3f33 to your computer and use it in GitHub Desktop.
Install Docker and Docker-Compose using Ansible
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
- hosts: all | |
become: yes | |
gather_facts: false | |
tasks: | |
- name: Install docker packages | |
remote_user: ubuntu | |
apt: | |
name: "{{ item }}" | |
state: present | |
update_cache: yes | |
with_items: | |
- apt-transport-https | |
- ca-certificates | |
- curl | |
- software-properties-common | |
tags: | |
- docker | |
- name: Add Docker s official GPG key | |
remote_user: ubuntu | |
apt_key: | |
url: https://download.docker.com/linux/ubuntu/gpg | |
state: present | |
tags: | |
- docker | |
- name: Verify that we have the key with the fingerprint | |
remote_user: ubuntu | |
apt_key: | |
id: 0EBFCD88 | |
state: present | |
tags: | |
- docker | |
- name: Set up the stable repository | |
remote_user: ubuntu | |
apt_repository: | |
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable | |
state: present | |
update_cache: yes | |
tags: | |
- docker | |
- name: Update apt packages | |
remote_user: ubuntu | |
apt: | |
update_cache: yes | |
tags: | |
- docker | |
- name: Install docker | |
remote_user: ubuntu | |
apt: | |
name: docker-ce | |
state: present | |
update_cache: yes | |
#notify: Start docker on boot | |
tags: | |
- docker | |
- name: Add remote "ubuntu" user to "docker" group | |
remote_user: ubuntu | |
user: | |
name: "ubuntu" | |
group: "docker" | |
append: yes | |
tags: | |
- docker | |
- name: Install docker-compose | |
remote_user: ubuntu | |
get_url: | |
url : https://github.com/docker/compose/releases/download/1.25.1-rc1/docker-compose-Linux-x86_64 | |
dest: /usr/local/bin/docker-compose | |
mode: 'u+x,g+x' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment