Compare commits

...

3 commits

Author SHA1 Message Date
Kevin Heyer
19ffd5953f create playbook for docker1 2025-06-10 22:07:17 +02:00
Kevin Heyer
59db1cc23a linting 2025-06-10 22:07:03 +02:00
Kevin Heyer
8d87025817 change config 2025-06-10 22:06:49 +02:00
7 changed files with 21 additions and 13 deletions

2
.ansible-lint Normal file
View file

@ -0,0 +1,2 @@
skip_list:
- var-naming

1
.gitignore vendored
View file

@ -4,6 +4,7 @@ inventory/
# Ignore .secret files.... you know, there secret... # Ignore .secret files.... you know, there secret...
*.secret *.secret
.vault-* .vault-*
vault.secret
# Ignore Caching # Ignore Caching
cache/ cache/

View file

@ -10,7 +10,7 @@ fact_caching_connection = ./cache
fact_caching_timeout = 86400 fact_caching_timeout = 86400
# Rollen-Pfade # Rollen-Pfade
roles_path = ./roles/global:./roles/custom roles_path = ./roles/
# Vault-Einstellungen # Vault-Einstellungen
vault_password_file = ./vault.secret vault_password_file = ./vault.secret

View file

@ -0,0 +1,5 @@
---
- name: Install and start Apache web server
hosts: docker1
roles:
- server_install_ssh

View file

@ -5,4 +5,4 @@ ssh_user: skulladmin
ssh_public_key: "" ssh_public_key: ""
# SSH-Port # SSH-Port
ssh_port: 22 ssh_port: 22

View file

@ -1,5 +1,5 @@
--- ---
- name: Restart SSH - name: Restart SSH
service: ansible.builtin.service:
name: ssh name: ssh
state: restarted state: restarted

View file

@ -1,22 +1,22 @@
--- ---
- name: Paketlisten aktualisieren - name: Paketlisten aktualisieren
apt: ansible.builtin.apt:
update_cache: yes update_cache: true
cache_valid_time: 3600 cache_valid_time: 3600
- name: OpenSSH Server installieren - name: OpenSSH Server installieren
apt: ansible.builtin.apt:
name: openssh-server name: openssh-server
state: present state: present
- name: Benutzer anlegen (falls nicht vorhanden) - name: Benutzer anlegen (falls nicht vorhanden)
user: ansible.builtin.user:
name: "{{ ssh_user }}" name: "{{ ssh_user }}"
shell: /bin/bash shell: /bin/bash
create_home: yes create_home: true
- name: SSH-Verzeichnis anlegen - name: SSH-Verzeichnis anlegen
file: ansible.builtin.file:
path: "/home/{{ ssh_user }}/.ssh" path: "/home/{{ ssh_user }}/.ssh"
state: directory state: directory
owner: "{{ ssh_user }}" owner: "{{ ssh_user }}"
@ -24,7 +24,7 @@
mode: '0700' mode: '0700'
- name: SSH-Key eintragen - name: SSH-Key eintragen
copy: ansible.builtin.copy:
content: "{{ ssh_public_key }}" content: "{{ ssh_public_key }}"
dest: "/home/{{ ssh_user }}/.ssh/authorized_keys" dest: "/home/{{ ssh_user }}/.ssh/authorized_keys"
owner: "{{ ssh_user }}" owner: "{{ ssh_user }}"
@ -32,10 +32,10 @@
mode: '0600' mode: '0600'
- name: SSH-Konfiguration per Template übertragen - name: SSH-Konfiguration per Template übertragen
template: ansible.builtin.template:
src: sshd_config.j2 src: sshd_config.j2
dest: /etc/ssh/sshd_config dest: /etc/ssh/sshd_config
owner: root owner: root
group: root group: root
mode: '0644' mode: '0644'
notify: Restart SSH notify: Restart SSH