-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu-base.yaml
95 lines (83 loc) · 2.2 KB
/
ubuntu-base.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
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
---
- name: Configure Ubuntu base system
hosts: local
become: false
pre_tasks:
- name: Install prerequisites for Docker repository
apt:
name:
- ca-certificates
- curl
state: present
become: true
- name: Create Docker keyring directory
file:
path: /etc/apt/keyrings
state: directory
mode: '0755'
become: true
- name: Download Docker's GPG key
get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /etc/apt/keyrings/docker.asc
mode: '0644'
become: true
- name: Set architecture fact
set_fact:
docker_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else ansible_architecture }}"
- name: Add Docker repository
apt_repository:
repo: "deb [arch={{ docker_arch }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
filename: docker
become: true
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
become: true
- name: Upgrade all packages
apt:
upgrade: yes
become: true
- name: Install required packages
apt:
name:
- build-essential
- curl
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- keychain
- nodejs
- pipx
- unzip
- python3-pip
- python3-pynvim
- silversearcher-ag
- universal-ctags
- docker-compose-plugin
state: present
become: true
- name: Install Neovim via snap
community.general.snap:
name: nvim
state: present
classic: true
become: true
- name: Add user to docker group
user:
name: "{{ lookup('env', 'USER') }}"
groups: docker
append: yes
become: true
- name: Restart docker service
systemd:
name: docker
state: restarted
become: true
- name: Reset connection to apply group changes
meta: reset_connection
roles:
- linux