Privileges are important
This commit is contained in:
parent
7b9d345ed8
commit
5894376128
@ -8,6 +8,7 @@
|
||||
fetch:
|
||||
src: /etc/ssh/sshd_config
|
||||
dest: "{{ inventory_hostname }}"
|
||||
become: yes
|
||||
|
||||
- name: Backup os-release
|
||||
fetch:
|
||||
@ -33,6 +34,7 @@
|
||||
exclusive: yes
|
||||
become: yes
|
||||
|
||||
|
||||
- name: Give all users exclusively the current controller user's SSH key
|
||||
ansible.posix.authorized_key:
|
||||
user: "{{item}}"
|
||||
@ -42,12 +44,13 @@
|
||||
become: yes
|
||||
loop: "{{ users_list.users }}"
|
||||
|
||||
- name: Ensure UFW is installed
|
||||
- block:
|
||||
- name: Ensure UFW is installed
|
||||
package:
|
||||
name: ufw
|
||||
state: present
|
||||
|
||||
- name: Configure ufw defaults
|
||||
- name: Configure ufw defaults
|
||||
ufw: direction={{ item.direction }} policy={{ item.policy }}
|
||||
with_items:
|
||||
- { direction: 'incoming', policy: 'deny' }
|
||||
@ -55,30 +58,30 @@
|
||||
notify:
|
||||
- restart ufw
|
||||
|
||||
- name: Configure ufw rules
|
||||
- name: Configure ufw rules
|
||||
ufw: rule={{ item.rule }} port={{ item.port }} proto={{ item.proto }}
|
||||
with_items:
|
||||
- { rule: 'limit', port: '22', proto: 'tcp' }
|
||||
notify:
|
||||
- restart ufw
|
||||
|
||||
- name: Enable ufw logging
|
||||
- name: Enable ufw logging
|
||||
ufw: logging=on
|
||||
notify:
|
||||
- restart ufw
|
||||
|
||||
- name: Enable ufw
|
||||
- name: Enable ufw
|
||||
ufw: state=enabled
|
||||
|
||||
- name: Change root password
|
||||
- name: Change root password
|
||||
user:
|
||||
name: root
|
||||
shell: /bin/bash
|
||||
password: "{{ genPass.stdout | password_hash('sha512') }}"
|
||||
|
||||
- name: Change admin password
|
||||
- name: Change admin password
|
||||
user:
|
||||
name: "{{ ansible_user }}"
|
||||
shell: /bin/bash
|
||||
password: "{{ genPass.stdout | password_hash('sha512') }}"
|
||||
|
||||
become: yes
|
||||
|
Loading…
Reference in New Issue
Block a user