Playbook will also install software-properties-common. Removed hardcoded host name.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Secure and Configure a New LXC Container
|
||||
hosts: ansible # Hosts or group defined in your inventory
|
||||
hosts: '{{ hosts_to_work_on }}' # Hosts or group defined in your inventory
|
||||
become: yes # Run all tasks as root (sudo)
|
||||
tasks:
|
||||
- name: 1. Create user '{{ target_user }}'
|
||||
@@ -31,6 +31,12 @@
|
||||
name: '{{ target_user }}'
|
||||
password_lock: yes
|
||||
|
||||
- name: 4.0. Install software-properties-common
|
||||
ansible.builtin.apt:
|
||||
name: software-properties-common
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: 4.1. Disallow root login over SSH
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
@@ -54,4 +60,4 @@
|
||||
listen: "restart sshd"
|
||||
ansible.builtin.service:
|
||||
name: sshd
|
||||
state: restarted
|
||||
state: restarted
|
||||
|
||||
Reference in New Issue
Block a user