-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathansible-debian-devtools.yml
More file actions
104 lines (92 loc) · 2.6 KB
/
Copy pathansible-debian-devtools.yml
File metadata and controls
104 lines (92 loc) · 2.6 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# setup.yml
---
- name: Setup Debian VM
hosts: all
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
- zsh
- tmux
- build-essential
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: Set zsh as default shell for user
user:
name: "{{ ansible_user }}"
shell: /bin/zsh
when: ansible_user is defined
- name: Clone dotfiles repository
git:
repo: https://github.com/danielfgray/dotfiles
dest: "~{{ ansible_user }}/dotfiles"
clone: yes
update: yes
become_user: "{{ ansible_user }}"
when: ansible_user is defined
- name: Run install.sh script
command: ./install.sh
become_user: "{{ ansible_user }}"
become: true
args:
chdir: "~{{ ansible_user }}/dotfiles"
creates:
- "~{{ ansible_user }}/.zshrc"
- "~{{ ansible_user }}/.profile"
- "~{{ ansible_user }}/.tmux.conf"
- "~{{ ansible_user }}/.config/nvim/init.lua"