-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_new_centos7.yml
116 lines (99 loc) · 2.25 KB
/
install_new_centos7.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
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
105
106
107
108
109
110
111
112
113
114
115
---
- hosts: testing
tasks:
### Set hostname
- name: Set hostname
hostname:
name: node1.local
### Set timezone Europe/Moscow
- name: Set timezone Europe/Moscow
timezone:
name: Europe/Moscow
### Install default packages
- name: Install default packages
yum: name={{ item }} state=latest
with_items:
- epel-release
- htop
- vim
- bash-completion
- nmap
- tcpdump
- net-tools
- bind-utils
### SSH
# PermitRootLogin no
# PermitEmptyPasswords no
# PasswordAuthentication no
# Banner /etc/ssh/banner
# /etc/motd
### SELinux
- name: Disable SELinux
selinux:
state: disabled
### Firewalld
- name: Stop & disabled firewalld
systemd:
name: firewalld
state: stopped
enabled: no
masked: yes
### Iptables
- name: Install iptables
yum:
name: iptables-services
state: latest
- name: Set default iptables config from template
template:
src: templates/iptables.rules.v4.j2
dest: /etc/sysconfig/iptables
owner: root
group: root
mode: 0600
- name: Start & enable iptables
systemd:
name: iptables
state: started
enabled: yes
masked: no
### Fail2ban
- name: Install fail2ban
yum:
name: fail2ban
state: latest
# cp jail.conf jail.local
# sshd enabled
# bantime = 600
# findtime = 600
# maxretry = 5
# destemail = root@localhost
# sender = root@localhost
# mta = sendmail
- name: Start & enable fail2ban
systemd:
name: fail2ban
state: started
enabled: yes
masked: no
### Zabbix-agent
- name: Install zabbix-agent rpm repo
yum:
name: https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
state: present
- name: Install zabbix-agent
yum:
name: zabbix-agent
state: latest
- name: Config zabbix-agent
template:
src: templates/zabbix_agentd.conf.j2
dest: /etc/zabbix/zabbix_agentd.conf
owner: root
group: root
mode: 0644
- name: Start & enable zabbix-agent
systemd:
name: zabbix-agent
state: started
enabled: yes
masked: no