initial commit

This commit is contained in:
Riedel
2026-08-19 09:51:43 +02:00
commit d777c1e975
79 changed files with 2263 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
- name: restart chrony
ansible.builtin.systemd:
name: "{{ base_os_chrony_service_name }}"
state: restarted

View File

@@ -0,0 +1,75 @@
---
- name: Include OS-family-specific variables
ansible.builtin.include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_facts['os_family'] }}.yml"
- "default.yml"
tags: [base_os, always]
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
when: ansible_facts['os_family'] == "Debian"
tags: [base_os]
- name: Install base packages
ansible.builtin.package:
name: "{{ base_os_packages + (base_extra_packages | default([])) }}"
state: present
tags: [base_os]
- name: Set timezone
community.general.timezone:
name: "{{ timezone }}"
tags: [base_os]
- name: Deploy chrony configuration
ansible.builtin.template:
src: chrony.conf.j2
dest: "{{ base_os_chrony_config_path }}"
owner: root
group: root
mode: "0644"
notify: restart chrony
tags: [base_os]
- name: Enable and start chrony
ansible.builtin.systemd:
name: "{{ base_os_chrony_service_name }}"
enabled: true
state: started
tags: [base_os]
- name: Set hostname from inventory
ansible.builtin.hostname:
name: "{{ inventory_hostname }}"
tags: [base_os]
- name: Remove unwanted packages
ansible.builtin.package:
name: "{{ base_os_unwanted_packages }}"
state: absent
tags: [base_os, cis_hardening]
- name: Gather service facts
ansible.builtin.service_facts:
tags: [base_os]
- name: Disable unneeded services if installed
ansible.builtin.systemd:
name: "{{ item }}"
enabled: false
state: stopped
loop: "{{ base_unneeded_services }}"
when: (item + '.service') in ansible_facts.services
tags: [base_os]
- name: Deploy post-login MOTD
ansible.builtin.template:
src: motd.j2
dest: /etc/motd
owner: root
group: root
mode: "0644"
tags: [base_os]

View File

@@ -0,0 +1,9 @@
# {{ ansible_managed }}
{% for server in ntp_servers %}
server {{ server }} iburst
{% endfor %}
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony

View File

@@ -0,0 +1,6 @@
******************************************************************
AUTHORIZED ACCESS ONLY.
All activity on this system is logged and monitored.
Unauthorized access is prohibited and may be prosecuted.
Managed via Ansible ({{ inventory_hostname }}).
******************************************************************

View File

@@ -0,0 +1,17 @@
---
base_os_packages:
- vim
- chrony
- auditd
- firewalld
- rsyslog
- sudo
base_os_unwanted_packages:
- sendmail
- telnet
- rsh-client
- rsh-redone-client
- nis
- tftp
base_os_chrony_config_path: /etc/chrony/chrony.conf
base_os_chrony_service_name: chrony

View File

@@ -0,0 +1,17 @@
---
base_os_packages:
- vim-enhanced
- chrony
- audit
- policycoreutils-python-utils
- firewalld
- rsyslog
- sudo
base_os_unwanted_packages:
- sendmail
- telnet
- rsh
- ypbind
- tftp
base_os_chrony_config_path: /etc/chrony.conf
base_os_chrony_service_name: chronyd