Playbook will also install software-properties-common. Removed hardcoded host name.

This commit is contained in:
2025-08-24 13:27:53 +02:00
parent 7c71697722
commit 7bd28950ca
2 changed files with 11 additions and 3 deletions

View File

@@ -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