fix: rename roles to use underscores instead of hyphens which was causing the roles not to be found

This commit is contained in:
2026-04-14 15:19:21 -04:00
parent b2379e597e
commit 62f4a3ea73
31 changed files with 31 additions and 31 deletions

View File

@@ -0,0 +1,5 @@
---
- name: Install extra packages
package:
name: "{{ extra_packages }}"
state: present

View File

@@ -0,0 +1,14 @@
---
# Upgrade and update packages
- include_role:
name: system_maintenance
# Install extra packages
- include_tasks: extra-packages.yaml
# Create a user admin account
- include_tasks: user.yaml
# Harden SSH configuration
- include_tasks: ssh.yaml

View File

@@ -0,0 +1,32 @@
---
- name: Update SSH configuration for better security
become: true
template:
src: '../templates/sshd_config.j2'
dest: '/etc/ssh/sshd_config'
owner: root
mode: '0600'
validate: '/usr/sbin/sshd -t -f %s'
notify: Restart sshd daemon
- name: Find all existing SSH host keys
find:
paths: '/etc/ssh'
patterns: "ssh_host_*_key*"
register: existing_ssh_host_keys
when: regenerate_ssh_host_keys | bool
- name: Delete previous existing SSH host keys
become: true
file:
path: "{{ item.path }}"
state: absent
loop: "{{ existing_ssh_host_keys.files }}"
when: regenerate_ssh_host_keys | bool
- name: Generate new SSH host keys
become: true
command: ssh-keygen -A
changed_when: true
when: regenerate_ssh_host_keys | bool
notify: Restart sshd daemon

View File

@@ -0,0 +1,25 @@
---
- name: "Create a new user {{ username }}"
user:
name: "{{ username }}"
password: "{{ password | password_hash('sha512') }}"
groups:
- sudo
shell: "{{ shell }}"
state: present
append: true
- name: Allow sudo to be used without a password
lineinfile:
path: /etc/sudoers
state: present
regexp: '^%sudo'
line: '%sudo ALL=(ALL) NOPASSWD: ALL'
validate: 'visudo -cf %s'
when: passwordless_sudo | bool
- name: Copy over the public SSH key
authorized_key:
user: "{{ username }}"
state: present
key: "{{ lookup('file', ssh_pubkey_file) }}"