-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.yml
58 lines (48 loc) · 1.12 KB
/
site.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
---
- name: Configure bare metal server
hosts: all
become: true
vars:
ansible_become_password: "{{ vault_sudo_user_password }}"
pre_tasks:
# Run apt update
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
when: ansible_os_family == "Debian"
# Install required system packages
- name: Install system packages
ansible.builtin.apt:
name: "{{ item }}"
state: present
loop: "{{ system_packages }}"
roles:
- role: nginx
tags:
- webserver
- role: user_management
tags:
- users
- role: log_management
tags:
- logs
- monitoring
- role: firewall
tags:
- firewall
- role: security
tags:
- security
post_tasks:
- name: Ensure all configured services are started
ansible.builtin.service:
name: "{{ item }}"
state: started
enabled: true
loop:
- nginx
- ufw
- promtail
- name: Print completion message
ansible.builtin.debug:
msg: "Server configuration completed successfully!"