0
0
vps-set-up-playbook/roles/docker/tasks/main.yaml

47 lines
1.0 KiB
YAML

- name: Install packages
apt:
name:
- docker.io
- docker-compose
state: latest
install_recommends: false
# ---------------------------------------------------------------------------------------------------
- name: Create Docker directory
file:
path: "/home/{{ user }}/Docker"
state: directory
owner: 1000
group: 1000
mode: 0755
# ---------------------------------------------------------------------------------------------------
- name: Set permissions for Docker socket
file:
path: /var/run/docker.sock
mode: 0666
- name: Add user to Docker group
user:
name: "{{ user }}"
groups: docker
append: true
# ---------------------------------------------------------------------------------------------------
- name: Set up Docker daemon configuration file to enable IPv6
template:
src: "daemon.json.j2"
dest: "/etc/docker/daemon.json"
owner: 0
group: 0
mode: 0644
- name: Restart docker
service:
name: docker
enabled: true
state: restarted