docker-services/tasks/docker.yml

59 lines
1.2 KiB
YAML
Raw Normal View History

2022-08-05 20:59:55 +02:00
---
- name: add official GPG key
apt_key:
url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
state: present
tags: ['docker']
- name: add repository
apt_repository:
repo: "deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
state: present
tags: ['docker']
- name: install packages
apt:
name:
- docker-ce
- docker-ce-cli
- docker-compose
state: present
tags: ['docker']
- name: create docker-compose directory
file:
path: /opt/docker-compose
state: directory
mode: '0755'
tags: ['docker']
- name: install Python module
pip:
name:
- docker
- docker-compose
2022-10-03 15:31:44 +02:00
executable: pip3
2022-08-05 20:59:55 +02:00
tags: ['docker']
- name: ensure Docker is started and enabled at boot
service:
name: docker
state: started
enabled: true
tags: ['docker']
- name: copy rsyslog config
copy:
src: traefik/rsyslog
dest: /etc/rsyslog.d/10-docker.conf
mode: '0644'
force: yes
when: rsyslog_docker is defined
2022-08-05 20:59:55 +02:00
- name: copy logrotate config
copy:
src: traefik/logrotate
dest: /etc/logrotate.d/docker
mode: '0644'
force: yes
when: logrotate_docker is defined