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 032459fdfc
commit 0a3b5a9e2c
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

View File

@@ -4,3 +4,5 @@ my_public_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINSGj0dxaA38QSBVY3DZiPb+qmIuTFxGo0mt4sbmYDa3 mbuz@macbook-pro"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOpvRkew+XpOAt7I/mizQbE/OJP1SO6NVl2/A1ZGzdU3 mbuz@windows-desktop"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIGWMJbHDCB8XCxPGth1229A3W/sPpvJHO9xBvegv4Sx mbuz@macbook-air"
hosts_to_work_on: ansible