-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathansible-debian-production.yml
More file actions
85 lines (75 loc) · 1.96 KB
/
Copy pathansible-debian-production.yml
File metadata and controls
85 lines (75 loc) · 1.96 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# ansible-debian-production.yml
---
- name: Setup Production VM
hosts: production
become: true
tasks:
- name: Remove old Docker repo config
file:
path: "{{ item }}"
state: absent
loop:
- /etc/apt/sources.list.d/docker.list
- /etc/apt/sources.list.d/docker.sources
- /etc/apt/keyrings/docker.gpg
- name: Install prerequisites
apt:
name:
- ca-certificates
- curl
state: present
update_cache: true
- name: Create keyrings directory
file:
path: /etc/apt/keyrings
state: directory
mode: '0755'
- name: Add Docker GPG key
get_url:
url: https://download.docker.com/linux/debian/gpg
dest: /etc/apt/keyrings/docker.asc
mode: '0644'
- name: Remove existing Docker sources file
file:
path: /etc/apt/sources.list.d/docker.sources
state: absent
- name: Add Docker repository
copy:
dest: /etc/apt/sources.list.d/docker.sources
content: |
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: {{ ansible_facts["distribution_release"] }}
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
- name: Install Docker packages
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
update_cache: true
- name: Ensure Docker service is running
service:
name: docker
state: started
enabled: true
- name: Add user to docker group
user:
name: "{{ ansible_user }}"
groups: docker
append: true
when: ansible_user is defined
- name: Install tools
apt:
name:
- git
- tmux
- htop
- curl
- wget
- unzip
state: present