docker_compose_install - fixup from docker-install

python 3 etc.
This commit is contained in:
Nick Stokoe
2020-11-29 15:18:36 +00:00
parent 4be8345f39
commit e23ba65b8f
2 changed files with 19 additions and 5 deletions

View File

@@ -0,0 +1,16 @@
---
## Installs docker-CE
# Following guide from here:
# https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository
# The docker apt repo key uri
docker_compose_install_apt_key_uri: https://download.docker.com/linux/ubuntu/gpg
# The docker apt repo config line
docker_compose_install_apt_repo: deb https://download.docker.com/linux/ubuntu {{ansible_lsb.codename}} stable
# This needs to be supplied externally.
# Get this version from https://github.com/docker/compose/releases/
# Check compatibility with docker.
#docker_compose_install_compose_version:

View File

@@ -0,0 +1,58 @@
---
- name: install prereqs (apt)
apt:
update_cache: true
name:
- apt-transport-https
- ca-certificates
- software-properties-common
- python3-pip
- virtualenv
- python3-setuptools
- python3-docker
- name: add docker repository key
apt_key:
url: "{{ docker_compose_install_apt_key_uri }}"
state: present
- name: add docker repository
apt_repository:
repo: "{{ docker_compose_install_apt_repo }}"
filename: docker-ce
state: present
update_cache: true
- name: install docker-ce
apt:
name:
- docker-ce
# Oddly, there is no docker-compose PPA, the suggested linux install
# method is to download a binary. See:
# https://docs.docker.com/compose/install/#master-builds
- name: install docker-compose
pip:
name:
- docker-compose
- name: docker daemon configuration
copy:
dest: /etc/docker/daemon.json
content: |-
{
"log-driver": "json-file",
"log-opts": {
"max-size": "30m"
}
}
notify:
- restart docker daemon
- name: enable docker
service:
name: docker
state: started
enabled: yes