Skip to content

Instantly share code, notes, and snippets.

@mazz
Created Jun 12, 2021
Embed
What would you like to do?
---
- name: Install aptitude using apt
apt:
name: aptitude
state: latest
update_cache: yes
force_apt_get: yes
- name: Install haveged
apt:
name:
- haveged
state: present
update_cache: yes
notify: Start haveged on boot
tags:
- haveged
- name: Install docker packages
apt:
name:
- apt-transport-https
- build-essential
- mc
- mosh
- fail2ban
- ca-certificates
- curl
- software-properties-common
state: present
update_cache: yes
tags:
- docker
- name: Add Docker's official GPG key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
tags:
- docker
- name: Verify that we have the key with the fingerprint
apt_key:
id: 0EBFCD88
state: present
tags:
- docker
- name: Set up the stable repository
apt_repository:
repo: deb http://ftp.de.debian.org/debian stable main
state: present
update_cache: yes
tags:
- docker
- name: Update apt packages
apt:
update_cache: yes
tags:
- docker
- name: Install docker
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
update_cache: yes
notify: Start docker on boot
tags:
- docker
- name: Add remote "ubuntu" user to "docker" group
user:
name: "{{ remote_user }}"
group: "{{ docker_group }}"
append: yes
tags:
- docker
- name: Check current docker-compose version.
command: docker-compose --version
register: docker_compose_current_version
changed_when: False
failed_when: False
- name: Delete existing docker-compose version if it's different.
file:
path: "{{ docker_compose_path }}"
state: absent
when: >
docker_compose_current_version.stdout is defined
and docker_compose_version not in docker_compose_current_version.stdout
- name: Install Docker Compose (if configured).
get_url:
url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64
dest: "{{ docker_compose_path }}"
mode: 0755
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment