ansible-role-server/tasks/docker.yml

55 lines
1.3 KiB
YAML

---
# Server/Docker: Install Docker and Docker-Compose
# Install docker CE
- name: docker - Install docker CE APT dependencies
become: yes
apt:
name: "{{ packages }}"
state: latest
vars:
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg2
- software-properties-common
- name: docker - Add docker CE repo key
become: yes
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
- name: docker - Add docker CE add repo
become: yes
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/debian stretch stable
state: present
- name: docker - Install docker CE
become: yes
apt:
name: docker-ce
state: latest
update_cache: yes
cache_valid_time: 3600
# Install docker-compose (TODO: do not use a static docker-compose version)
- name: docker - Install docker-compose
become: yes
get_url:
url: https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64
dest: /usr/local/bin/docker-compose
- name: docker - Make docker-compose executable
become: yes
file:
path: /usr/local/bin/docker-compose
mode: 0755
# Other setup tasks
- name: docker - Add standard user to docker group
become: yes
user:
name: "{{ ansible_user_id }}"
groups: docker
append: yes