kovalhome/infra/cloud/0002_docker_playbook.yaml

48 lines
1.3 KiB
YAML
Raw Normal View History

2023-09-25 20:48:29 +00:00
- name: Install software
hosts: cloud
gather_facts: false
tasks:
- name: Wait for connection
ansible.builtin.wait_for_connection:
timeout: 300
- name: Install dependencies
ansible.builtin.apt:
2023-09-25 20:57:43 +00:00
update_cache: true
2023-09-25 21:30:52 +00:00
pkg:
2023-09-25 20:48:29 +00:00
- curl
- python3-apt
- gpg
become: true
- name: Add docker key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/debian/gpg
2023-09-25 21:12:03 +00:00
keyring: /etc/apt/keyrings/docker.gpg
2023-09-25 20:48:29 +00:00
become: true
- name: Add docker repo
ansible.builtin.apt_repository:
repo: deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable
become: true
- name: Install docker
ansible.builtin.apt:
2023-09-25 20:57:43 +00:00
update_cache: true
2023-09-25 21:30:52 +00:00
pkg:
2023-09-25 20:48:29 +00:00
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
become: true
2023-09-25 21:51:05 +00:00
- name: Add user to docker group
ansible.builtin.user:
user: debian
groups:
- docker
append: true
2023-09-25 23:29:21 +00:00
become: true
2023-09-25 23:40:09 +00:00
- name: Enable docker
ansible.builtin.systemd:
name: docker
state: started
enabled: true
become: true