Add role docker

role_docker
Ruakij 2 years ago
parent 06eb8456ab
commit 6adb029849

@ -0,0 +1,2 @@
#!/bin/sh
docker compose $@

@ -0,0 +1,4 @@
- name: restart_docker
service:
name: "docker"
state: restarted

@ -0,0 +1,40 @@
#- name: Check if docker is already installed
# stat:
# path: /usr/bin/docker
# register: docker_file
- name: Install Packages
# when: docker_file.stat.exists == False
package:
name:
- gpg
- gpg-agent
- name: Add docker-key
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
- name: Add docker-repository
apt_repository:
repo: "deb https://download.docker.com/linux/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release }} stable"
state: present
filename: docker
update_cache: yes
- name: Install docker
package:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
- pass
state: latest
- name: Deploy docker-compose command to new docker compose plugin
ansible.builtin.copy:
src: docker-compose
dest: "/usr/local/bin/docker-compose"
mode: preserve
Loading…
Cancel
Save