self-hosting/roles/forgejo/tasks/ssh.yml

41 lines
778 B
YAML
Raw Normal View History

2023-01-18 16:15:24 +01:00
---
2024-04-09 20:21:59 +02:00
2023-01-19 10:02:17 +01:00
- name: Create .ssh dir
2023-01-18 16:15:24 +01:00
become: true
become_user: git
2023-01-19 10:02:17 +01:00
ansible.builtin.file:
path: ~/.ssh
owner: git
group: git
mode: 0700
2023-01-18 16:15:24 +01:00
2023-01-19 10:02:17 +01:00
- name: Add SSH public key
become: true
become_user: git
ansible.builtin.copy:
2023-10-01 17:30:38 +02:00
content: "{{ forgejo_git_ssh_keys.pub }}"
2023-01-19 10:02:17 +01:00
dest: ~/.ssh/id_rsa.pub
owner: git
group: git
mode: 0644
2023-01-18 16:15:24 +01:00
2023-01-19 10:02:17 +01:00
- name: Add SSH private key
become: true
become_user: git
ansible.builtin.copy:
2023-10-01 17:30:38 +02:00
content: "{{ forgejo_git_ssh_keys.priv }}"
2023-01-19 10:02:17 +01:00
dest: ~/.ssh/id_rsa
owner: git
group: git
mode: 0600
2024-07-21 00:04:19 +02:00
- name: Copy sshd_config
become: true
ansible.builtin.template:
src: sshd_config.j2
dest: /etc/ssh/sshd_config.d/01-forgejo.conf
mode: "644"
owner: root
group: root
notify: Restart sshd service