-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlinux-postinstall.yml
71 lines (62 loc) · 1.87 KB
/
linux-postinstall.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
---
- name: Linux post install procedures
hosts: all
gather_facts: true
tasks:
- name: Upgrade all packages
ansible.builtin.yum:
name: '*'
state: latest
- name: Make sure firewalld service unit is running
ansible.builtin.systemd:
state: started
name: firewalld
enabled: yes
- name: Copy the sshd-banner file into place
ansible.builtin.copy:
src: files/sshd-banner
dest: /etc/ssh/sshd-banner
owner: root
group: root
mode: u+rw,g-wx,o-wx
- name: Updating the sshd_config file to show the new banner
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
state: present
regexp: '^#Banner none'
line: 'Banner /etc/ssh/sshd-banner'
- name: Disabling root login via ssh
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
state: present
regexp: '^#PermitRootLogin yes'
line: 'PermitRootLogin no'
- name: Reloading sshd service
ansible.builtin.systemd:
state: reloaded
name: sshd.service
enabled: yes
- name: Copy the new /etc/motd into place
ansible.builtin.copy:
src: files/motd
dest: /etc/motd
owner: root
group: root
mode: u+rw,g-wx,o-wx
- name: Copy the new /etc/issue into place
ansible.builtin.copy:
src: files/issue
dest: /etc/issue
owner: root
group: root
mode: u+rw,g-wx,o-wx
- name: Get rid of the cockpit.socket message
ansible.builtin.file:
src: /dev/null
dest: /etc/motd.d/cockpit
owner: root
group: root
state: link
when: "ansible_distribution_release != 'Maipo'"
- name: Unconditionally reboot the machine with all defaults
ansible.builtin.reboot: