2023-11-11 02:06:42 +08:00
|
|
|
- name: Install packages
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- docker.io
|
|
|
|
- docker-compose
|
|
|
|
state: latest
|
|
|
|
install_recommends: false
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
- name: Create Docker directory
|
|
|
|
file:
|
2023-11-13 11:47:39 +08:00
|
|
|
path: "/home/{{ user }}/Docker"
|
2023-11-11 02:06:42 +08:00
|
|
|
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:
|
2023-11-13 11:47:39 +08:00
|
|
|
name: "{{ user }}"
|
2023-11-11 02:06:42 +08:00
|
|
|
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
|
2023-11-14 00:06:09 +08:00
|
|
|
mode: 0644
|
2023-11-11 02:06:42 +08:00
|
|
|
|
|
|
|
- name: Restart docker
|
|
|
|
service:
|
|
|
|
name: docker
|
|
|
|
enabled: true
|
2023-11-13 11:47:39 +08:00
|
|
|
state: restarted
|