-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker.yaml
60 lines (51 loc) · 1.62 KB
/
docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
- hosts: dockerhost.cg.home.arpa
gather_facts: yes
become: yes
tasks:
# Add Docker's official GPG key
- name: Run the equivalent of "apt-get update" as a separate step
ansible.builtin.apt:
update_cache: yes
- name: Install a list of packages
ansible.builtin.apt:
pkg:
- ca-certificates
- curl
- name: Create a /etc/apt/keyrings directory if it does not exist
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
mode: "0755"
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
keyring: /etc/apt/keyrings/docker.gpg
state: present
- name: Change permission on/etc/apt/keyrings/docker.gpg
ansible.builtin.file:
path: /etc/apt/keyrings/docker.gpg
state: file
owner: root
group: root
mode: a+r
- name: Add Docker Repository
apt_repository:
repo: deb [ arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release | lower }} stable
state: present
- name: Run the equivalent of "apt-get update" as a separate step
ansible.builtin.apt:
update_cache: yes
- name: Install a list of packages
ansible.builtin.apt:
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
- name: adding docker users (for use without sudo)
user:
name: cloudgenius
append: yes
groups: docker