-
Notifications
You must be signed in to change notification settings - Fork 0
/
almalinux9.yml
65 lines (54 loc) · 1.49 KB
/
almalinux9.yml
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
---
- hosts: almalinux9
become: yes
tasks:
- name: Install required packages
yum:
name: ['git', 'certbot', 'nano', 'bash-completion', 'epel-release', 'yum-utils', 'sqlite', 'lsof', 'firewalld' ]
state: latest
- name: Add Docker repo
command:
cmd: yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
- name: Install Docker
yum:
name: ['docker-ce', 'docker-ce-cli', 'containerd.io']
state: latest
- name: Start and enable Docker service
systemd:
name: docker
state: started
enabled: yes
- name: Install Docker Compose
yum:
name: docker-compose
state: latest
- name: Create swapfile
command: fallocate -l 1G /swapfile
- name: Set correct permissions for swapfile
file:
path: /swapfile
mode: '0600'
- name: Setup swap space
command: mkswap /swapfile
- name: Enable swap space
command: swapon /swapfile
- name: Add swapfile to fstab
lineinfile:
path: /etc/fstab
line: '/swapfile swap swap defaults 0 0'
state: present
- name: Start and enable firewalld service
systemd:
name: firewalld
state: started
enabled: yes
- name: Allow only specific services in firewalld
firewalld:
service: "{{ item }}"
permanent: yes
state: enabled
loop:
- ssh
- http
- https
...