From 9c083b808929650cfb7c564cac3289c7dfc21062 Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 26 Jul 2022 19:50:17 +0200 Subject: [PATCH] template config ssh --- defaults/main.yml | 5 +++++ tasks/ssh.yml | 2 +- files/ssh/config => templates/ssh/config.j2 | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) rename files/ssh/config => templates/ssh/config.j2 (90%) diff --git a/defaults/main.yml b/defaults/main.yml index 34e9fd2..223b8be 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -120,3 +120,8 @@ hosts_entries: [] hosts_file_snippets: [] system_ipV6_disable: true + +system_ssh_custom_host: +# - host: +# user: +# keyfile: diff --git a/tasks/ssh.yml b/tasks/ssh.yml index 8a90100..2bb6aac 100644 --- a/tasks/ssh.yml +++ b/tasks/ssh.yml @@ -1,6 +1,6 @@ - name: copy ssh config for user become: true - copy: + template: dest: /home/{{ item }}/.ssh/ src: "ssh/config" force: true diff --git a/files/ssh/config b/templates/ssh/config.j2 similarity index 90% rename from files/ssh/config rename to templates/ssh/config.j2 index 4e6113d..be4639b 100644 --- a/files/ssh/config +++ b/templates/ssh/config.j2 @@ -48,3 +48,9 @@ Hostname git.ducamps.win User git IdentityFile ~/.ssh/id_gitea +{% for host in system_ssh_custom_host %} +Host {{ host.host }} + Hostname: {{ host.host }} + User {{ host.user }} + IdentityFile {{ host.keyfile }} +{% endfor %}