Add playbooks/ssh.yml

This commit is contained in:
2026-06-13 13:41:42 +01:00
parent fcd45a99a4
commit f6b849e231

51
playbooks/ssh.yml Normal file
View File

@@ -0,0 +1,51 @@
- name: configure ssh
hosts: apache-intranet
become: true
tasks:
- name: copy the favourite icon
copy:
src: ../configs/favicon.ico
dest: /var/www/intranet
owner: root
group: root
mode: 0644
- name: create .ssh dir for jigglypuff
file:
path: "/home/jigglypuff/.ssh"
state: directory
owner: jigglypuff
group: jigglypuff
mode: 0700
- name: create custom jigglypuff ssh parameters
ansible.builtin.copy:
src: "{{ item }}"
dest: /etc/ssh/sshd_config.d/
owner: root
group: root
mode: 0644
loop:
- ../configs/jigglypuff.conf
- ../configs/password-login.conf
- ../configs/root-login.conf
- name: generate jigglypuff's ssh key pair
community.crypto.openssh_keypair:
path: "./jigglypuff"
type: ed25519
delegate_to: localhost
- name: install jigglypuff's public key
ansible.posix.authorized_key:
user: jigglypuff
state: present
key: "{{ lookup('file', playbook_dir + '/jigglypuff.pub') }}"
- name: restart ssh
ansible.builtin.systemd:
name: ssh
state: restarted