infra/playbooks/roles/docker/tasks/main.yml

61 lines
1.3 KiB
YAML

---
- name: Install dependencies
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
state: present
update_cache: true
- name: Docker GPG key
ansible.builtin.apt_key:
url: >
https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
state: present
- name: Repository docker
ansible.builtin.apt_repository:
repo: >
deb https://download.docker.com/linux/{{ ansible_distribution | lower }}
{{ ansible_distribution_release }} stable
state: present
- name: Install docker
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
update_cache: true
notify:
- Enable docker
- name: Copy docker-compose@.service
ansible.builtin.copy:
src: docker-compose@.service
dest: /etc/systemd/system/docker-compose@.service
owner: root
group: root
mode: u=rw,g=r,o=r
- name: Ensure /etc/docker/compose exist
ansible.builtin.file:
path: /etc/docker/compose
state: directory
owner: root
group: root
mode: 0700
- name: Copy docker rollout script
ansible.builtin.copy:
src: docker-rollout
dest: /usr/local/bin/docker-rollout
owner: root
group: root
mode: 0755